use strict; local $\ = "\n"; local $_ = 'x' x 1000; my $pat = qr/.{1,60}/; while (/($pat)/g) { print $1; }