while ( $str1 =~ /^(\S+\s+)(\S+\s+\S+)/ ) { print "$1$2\n"; $str1 = "$2$'"; $n++; }