Jeff 'Japhy' Pinyan wrote:
> On Nov 15, Paul Harwood said:
>
> >push @{$names{TEST}}, $another_name
> >  unless grep ($another_name, @{$names{TEST}});
>
> >I thought that the $another_name scalar would be pushed once a grep of
> >the nested array shows that it doesn't already exist. How can I make
> >this work?
>
> That's because you're assuming the test is implicit; it's not:

Nice answer Jeff.

>   unless grep $_ eq $another_name, @{$names{TEST}};
>
> The grep() condition doesn't necessarily HAVE to be "the element equals
> X", so you have to give it explicitly.

DWIM stuff is good for the soul. How hashes are implemented leaves
you awake all night :)

/R



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to