$DIR_INPUT="./CAPTURE"; while($i <= $npages){ $FILE = $i . $IN_FILE; &wget($URL . $PAG . $i, $FILE, '', ''); #sub that call the wget &capture($FILE); } ... sub capture{ my $FILE = $_[0]; $fileContent = ` cat $DIR_INPUT/$FILE `; print $fileContent; # Here's where it stops ... }