use strict; use warnings; my $data; my $bytes = read( DATA, $data, 10 ); print "read $bytes bytes: [$data]\n"; # read 10 bytes: [1234567890] $bytes = read( DATA, $data, 5 ); print "read $bytes bytes: [$data]\n"; # read 5 bytes: [abcde] __DATA__ 1234567890abcdefg #### use strict; use warnings; my $data; while( read( DATA, $data, 5 ) ) { print "[$data]\n"; } __DATA__ Just another Perl hacker, #### [Just ] [anoth] [er Pe] [rl ha] [cker,]