in reply to boolean IN(); function in perl like

I can't resist

#!/usr/bin/perl -wl use strict; sub in { my $h = pop; @_ && ($h eq pop or in(@_, $h)) } my @a = qw(a b c d e f g h); print in(@a, $_) . " for $_ in (@a)" for qw(a c f v d s);

Replies are listed 'Best First'.
Re^2: boolean IN(); function in perl like
by EvilSuggestions (Acolyte) on Jan 18, 2005 at 21:53 UTC
    I can't resist one either:
    if ( $e == any( @a ) ) { ... }
    What, Perl 6 isn't out yet? Never mind then...
    "There is a thin line between ignorance and arrogance, and only I have managed to erase that line." - Dr. Science