Using the following input on a Window$ OS:

filename.0001.ext
filename.0002.ext
filename.0003.ext
filename.0004.ext
filename.0005.ext

And, the following script:

#!/usr/bin/perl -w

use strict;


print "\nThis program will change the file name(s) for
you.\n\n";

print "What's the current base name?: ";
chomp ( my $name = <STDIN> );

print "What's the current extention?: ";
chomp ( my $ext = <STDIN> );

my @old_names = ( glob "$name.*.$ext" );

print "\nThe following is your selection: ".
        "$old_names[0] - (", ++$#old_names, " frames).\n\n"; 

print "Type in the new basename and hit \"Enter\": ";
chomp ( my $new = <STDIN> );

if ( $new eq "" ) {
        print "\nYou must enter a name!\n\n";
                die "rename did not occur: $!";
} else {
        for ( @old_names ) {
                next unless /^$name\.(\d+)\.$ext$/;
                my $pad = $1;
                rename $_, sprintf "$new.%04d.$ext", $pad;
        }
}

I get the following error:

Use of uninitialized value in pattern match (m//) at
line 26, <STDIN> line 3.

The script gives no errors with 'warnings' turned off.

Can I safely ignore this error?



                
__________________________________ 
Do you Yahoo!? 
All your favorites on one personal page – Try My Yahoo!
http://my.yahoo.com 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to