in reply to Regex Word Pairs
Benchmarking is left as an exercise... ;)$_ = 'This is a test'; my @words = split; my @wordpairs = map {[ $words[$_-1], $words[$_] ]} 1..$#words;
Update: oops! I failed to notice that Joost already provided this solution. (I should have expected that he would.) Apologies for being redundant.
|
|---|