Short and readable:

@w = (1, 2, 3, 4, 5) ;
print "Found\n" if (grep { $_ == 3 } @w);

    Eli

Amir E. Aharoni wrote:

>my @set = (1, 2, 3, 4, 5);
>foreach (@set) {
>    if (3 == $_) {
>        print "found\n";
>      last;
>    }
>}
>
>  
>


-- 
Web: http://www.billauer.co.il


_______________________________________________
Perl mailing list
[email protected]
http://perl.org.il/mailman/listinfo/perl

Reply via email to