Hi Mike,

please reply to the list.

On Tue, 13 May 2014 12:49:42 -0500
Mike Dunaway <ekimduna...@gmail.com> wrote:

> Actually, can you tell me what's going on here:
> 
> my %words_lookup = (map { $_ => 1 } @words_to_look_for);
> 

I build a hash called %words_lookup whose keys are the entries of
@words_to_look_for and all of its values are 1. See:

http://perldoc.perl.org/functions/map.html

That way I can tell if a word is in @words_to_look_for quickly by doing:
exists($words_lookup{$word}).

Regards,

        Shlomi Fish


> That would be most helpful.
> 
> On 05/13/2014 03:08 AM, Shlomi Fish wrote:
> > my %words_lookup = (map { $_ => 1 } @words_to_look_for);
> 

        

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Apple Inc. is Evil - http://www.shlomifish.org/open-source/anti/apple/

<Botje>  Khisanth =~ s/must sleep/must give Botje all my money/ .
    — Freenode’s #perl

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to