$ cat main.pl #!/usr/bin/perl my %listing; open(LS, "ls img_*.jpg|"); foreach $file () { chomp($file); $file =~ /img_(\d{4})\.jpg/; my $old_num = $1; my $new_num = ($1 + 1300); $listing{$file} = "img_" . $new_num . ".jpg"; } while (($old, $new) = each(%listing)) { print "$old => $new"; print "\n"; system("mv ./$old ./$new"); } close(LS);