[Israel.pm] Is there an operator like IN in perl

Offer Kaye offer.kaye at gmail.com
Thu Mar 5 06:48:09 PST 2009


On Wed, Mar 4, 2009 at 4:21 PM, Berler Chanan wrote:
> 2) Using hash is great but I looked for more suite and elegant solution

You could simply wrap the hash solution in an appropriately names sub,
giving you the elegant solution for example:

{{{
if ( is_in_array(item => 'George' , aref => \@Beatles) )
}}}

You could even put "sub is_in_array" in a separate .pm file and "use"
it so that the user need never be exposed to the "ugly" code which
implements the pretty and elegant interface :)

Cheers,
-- 
Offer Kaye



More information about the Perl mailing list