- or download this
$string="abc de fgh ijkl";
...
{
print "$1 $1\n";
}
- or download this
abc de
fgh ijkl
- or download this
abc de
de fgh
fgh ijkl
- or download this
$string =~ /([a-z]+) ([a-z]+)\G(?: [a-z])*?/g
- or download this
my @words =split $string;
for($i=0;$i<$#words;$i++)
{
print "$words[$i] $words[$i+1]\n";
}