On 12/30/05, David Gilden <[EMAIL PROTECTED]> wrote: > $_ =~ /(\d+)/; > $num = int($1);
If there's no digit in $_, then $1 will be undef (or worse; see below). I think that's probably your bug: Some filename isn't like the others. Instead of this: > my @files =<*>; Consider something like this: my @files = <Gambia*.tiff>; Later, when you're trying to get the number from the string, you can allow for the possibility that there isn't one by checking the value of the pattern match. If it's false, the pattern didn't match, and you shouldn't use $1. if (/(\d+)/) { $num = $1; } else { warn "No digits found in '$_', continuing...\n"; next; } Hope this helps! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>