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