good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re^3: find acronyms in a textby arun_kom (Monk) |
on Jul 23, 2009 at 22:32 UTC ( [id://782804]=note: print w/replies, xml ) | Need Help?? |
Thanks a lot, but I don't understand the line my @words = $_ =~ m/\b[A-Z]+\b/g; I used regular expressions here to capture all consecutively appearing upper case alphabets separated by word boundaries (\b). Please check the perl regular expressions documentation You don't use split ? You could use split if you like but i think it is better to split by \W+ (non-word character) rather than \s+. This helps keep pattern matching simple in the next step. For the sample text below, using \s+ instead of \W+ would find none unless we perform a more complicated pattern matching later.
In Section
Seekers of Perl Wisdom
|
|