$new_string.="$&\n" while ($string=~ m/([^\n]+.*?\n){1,20}/gs); print "\n$new_string";