sub handlefix { my @return; for(@_){ my $val = $_; #decouple the value from the argument variable chomp($val); $val =~ s/"//g; $val =~ s/\//\\/g; } return @return; } ($infile,$outfile) = handlefix($infile,$outfile); #more obvious what is happening