my $string = 'a' x 150; my $max = 60; while( $string ) { print substr( $string, 0, $max ), "\n"; $string = substr $string, $max; }