That makes sense, thanks.

On 05/13/2014 01:46 PM, Shlomi Fish wrote:
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);
        



--
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