sub capture{ my $FILE = $_[0]; warn "FILE=$FILE"; $fileContent = ` cat $DIR_INPUT/$FILE `; warn "AFTER=$FILE"; print $fileContent; # it stops here }