foreach(@array){ my $item = $_; ... #### foreach(@attchfiles) { my $attchfilename = $_; $attchfilename =~ tr/A-Z/a-z/; rename($_, $attchfilename); } #### rename($_,lc) for @attchfiles; #### for(@attchfiles){ if ( -e lc ) { # do something appropriate! } else { rename $_,lc; } }