my @words = split " ", $text; print "$words[$_-1] $words[$_]\n" for ( 1 .. $#words );