in reply to How would I write this multiple substitution script?

Twice you do something like this:

foreach(@array){ my $item = $_; ...

The common way is just for my $item (@array) {.

Or take advantage of the default loop variable, $_. For example, this:

foreach(@attchfiles) { my $attchfilename = $_; $attchfilename =~ tr/A-Z/a-z/; rename($_, $attchfilename); }

Could be simplified as:

rename($_,lc) for @attchfiles;

But, you should probably make sure the lowercase file doesn't already exist. Perhaps like so:

for(@attchfiles){ if ( -e lc ) { # do something appropriate! } else { rename $_,lc; } }