> So my question: is any form of "logical-IN" operator in perl? > I.e. I have a scalar $var and a list @colors = ['red', > 'yellow', 'green']. All I want is to check > > if ($var in @color) { > traffic_lite($var) > } > > How could I realise this code in perl?
Use grep: @colors = ('red', 'yellow', 'green'); $var = 'green'; print "yep" if grep /$var/, @colors; -- Mark Thomas [EMAIL PROTECTED] Internet Systems Architect User Technology Associates, Inc. $_=q;KvtuyboopuifeyQQfeemyibdlfee;; y.e.s. ;y+B-x+A-w+s; ;y;y; ;;print;; _______________________________________________ Perl-Unix-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs