open IN, "out.txt" or die "Can't open out.txt for reading, Perl says $!"; print "Want ", (-s IN), "\n"; binmode IN; { local $/; # undef $/ so we read the whole file in $data = ; } print "Got ", length $data;