#!/usr/bin/perl use warnings; use strict; my $string = "x" x 100_400; { open ( my $sth, "<", \$string ) or die $!; local $/ = \1_000; while ( my $chunk = <$sth> ) { print $chunk, "\n"; } }