$ echo "123456789012" | perl -wle' my $data; while (read(STDIN, $data, 5)) { print "chunk: <$data>"; }' chunk: <12345> chunk: <67890> chunk: <12 > $