print $txt; # prints the text as expected. while (<$fh>){ # prints only part of the text. print $_; }