http://www.perlmonks.org?node_id=782695


in reply to Re: find acronyms in a text
in thread find acronyms in a text

my @words = $_ =~ m/\b[A-Z]+\b/g;

Aren't you missing capturing brackets there?

my @words = m/\b([A-Z]+)\b/g;
foreach(@words) { $acronyms_captured{$_} = undef; }

Personally, I'd write that as:

@acronyms_captured{@words} = ();

I like hash slices a lot :-)

--

See the Copyright notice on my home node.

Perl training courses