Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Regex Word Pairs

by graff (Chancellor)
on Aug 16, 2007 at 01:37 UTC ( [id://632899]=note: print w/replies, xml ) Need Help??


in reply to Regex Word Pairs

Not using regex matches at all might be a better solution.
$_ = 'This is a test'; my @words = split; my @wordpairs = map {[ $words[$_-1], $words[$_] ]} 1..$#words;
Benchmarking is left as an exercise... ;)

Update: oops! I failed to notice that Joost already provided this solution. (I should have expected that he would.) Apologies for being redundant.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://632899]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (1)
As of 2024-04-25 02:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found