foreach my $old( <*> ) { (my $new = lc $old) =~ s/ |%20/_/g; $new =~ s/%25//g; rename( $old, $new ) or warn "can't rename $old to $new: $!\n"; }