Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: find acronyms in a text

by davorg (Chancellor)
on Jul 23, 2009 at 14:59 UTC ( #782695=note: print w/replies, xml ) Need Help??


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

Replies are listed 'Best First'.
Re^3: find acronyms in a text
by arun_kom (Monk) on Jul 23, 2009 at 15:46 UTC
    well, i thought it didnt matter in this case either way as whatever is captured here is what i want ... but i guess adding capturing brackets to make it explicit is better practise.
    ... and also the same with using ( ) for undef
    am learning ... thanks

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://782695]
help
Chatterbox?
[marto]: when you work on the outside, for a client, you can make them aware of the stupids, but they don' t always listen :/
[Corion]: Yeah, you can lead them to water, but it's illegal to drown them...
[Discipulus]: Here my solution marto: create a win fake machine insied AD. do a micro fake partition foreach remote partition you wont to monit. put a web server that acept from data from remote systems and full fake partition as needed. fake partition are Mb. ;=)
[marto]: Discipulus yeah, the nuclear industry love fake machines sitting around on a controlled domain :P
[marto]: changing a typo on a website is often a great deal of paper work :P

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (10)
As of 2017-01-24 10:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (203 votes). Check out past polls.