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:

  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.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


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

Reply via email to