sub build_str { my ($str, $max) = ('', 200 * 1024); while ( length($str) < $max ) { # Assume lines are between 60-79 characters long $str .= ('#' x ((rand 20) + 60)) . "\n"; } return $str; }