MD> On Thu, 05 Apr 2007 01:58:15 +0200, Gunnar Hjalmarsson
MD> unless ( grep $temp eq $_, @values) { ... }
MD> But seriously, in this case hash look up is probably better...
MD> (too bad there's not a syntactically sweet enough way to make an array
MD> or a list into a hash(ref) with, say, undef values. In this case I can
MD> think of
MD> unless ( { map { $_ => 1 } @values}->{$temp} ) { ... } # )
and that rebuilds the anon hash each time which is not nice if it is
called more than once. maybe in a cgi or single shot script it would be
ok.
a simple way to make a hash of keys with undef values is:
my %isa_foo ;
@isa_foo{ @values } = () ;
i think i have seen tricks (randal?) on how to merge those line and i
bet abigail or damian could do it with an anon hash. but that is getting
to wacky for my taste. whenever i have a list of things to test against,
i usually need the list as an array too so making an array of foo and a
hash of isa_foo is best IMO (michele: see, i shifted there!)
uri