P is for Practical | |
PerlMonks |
Regex Word Pairsby logie17 (Friar) |
on Aug 15, 2007 at 23:11 UTC ( [id://632882]=perlquestion: print w/replies, xml ) | Need Help?? |
logie17 has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks, I am slowly trying to understand all the power you can weld with regular expressions. What I have is a string: "This is a test". I want to take all of the words within this string and find all the word pairs: "This is", "is a", "a test". I came up with this solution: Strictly for pedantic reasons, is there a better solution? Thanks,
s;;5776?12321=10609$d=9409:12100$xx;;s;(\d*);push @_,$1;eg;map{print chr(sqrt($_))."\n"} @_;
Back to
Seekers of Perl Wisdom
|
|