./rename *.pl "s/^/old_/" # will be expanded to this: ./rename 1.pl 2.pl 3.pl s/^/old_/ # and set @ARGV like so: $ARGV[0] == '1.pl'; $ARGV[1] == '2.pl'; $ARGV[2] == '3.pl'; $ARGV[3] == 's/^/old_/'; #### my $pattern = pop @ARGV; for my $file (@ARGV){ my $new = $file; # apply pattern and rename }