in reply to Re: Problem printing contents of file
in thread Problem printing contents of file

If you're going to tell him to use 3-arg open, you might as well recommend lexical file handles and a better error message too.

And I find it's usually better to check what you got rather than checking what you will get.

my $frame_qfn = 'temp'; open(my $frame_fh, '<', $frame_qfn) or die("Unable to open frame file $frame_qfn: $!\n"); while (<$frame_fh>) { print; } if (!$.) { print "$frame_fh contains no data\n"; }