binmode $fh; my $buff; my $total; while (read($fh,$buff,$max_buffer_size)) { $total .= $buff; # usually, you do something smarter than this... } # now all data is in $total.