i am a total n00b at perl. i just started learning yesterday. I wanted to make a script to rename extentions. this is what i've come up with. i can't figure out why it doesn't work. any help would be appreciated.
Code:
#!/usr/bin/perl
print "What ending would you like to change?";
$ending = <STDIN>;
chomp($ending);
print "What would you like to change it to?";
$new_ending = <STDIN>;
chomp($new_ending);
print "What is the directory you would like to change this in?";
$directory = <STDIN>;
chomp($directory);
print $ending, " ", $new_ending, " ", $directory, "\n";
chdir $directory;
@list = `ls *.$ending`;
foreach (@list) {
chop;
rename (".$ending", ".$new_ending") || die "Cannot delete $ending";
};
print "\n";
Comment