#/usr/bin/perl -w use bytes; my $max_size = 1024; $/ = \$max_size; while(<>) { print "chunk:", length $_,"\n", $_,"\n"; } print "OK\n";