How to rename a bunch of files according to some complex rule Feb 11, 2008 From Larry Wall himself: $op = shift or die "Usage: rename expr [files]\n"; chomp(@ARGV = <STDIN>) unless @ARGV; for ( @ARGV ) { $was = $_; eval $op; die $@ if $@; rename ( $was, $_ ) unless $was eq $_; }