in reply to How can I print all lines?

As a side note to what hippo said, consider using the three argument open, and report failures:

open( my $fh, "<", "Q.txt" ) or die "can't open file: $!";