my @words =split $string; for($i=0;$i<$#words;$i++) { print "$words[$i] $words[$i+1]\n"; }