in reply to Re: Re: Matching arrays?
in thread Matching arrays?

#!/usr/bin/perl use strict; my $check; my @text = ("Hi there 11", "Fred blamed me", "17 o clock", "It's snowi +ng hampsters", "Pickles are people too!"); foreach (@text) { if ( /11/ || /are/) { print "test successful"; $check++; } } unless ($check) { print "test failed"; }
of course you should also use strict!!

Replies are listed 'Best First'.
Re: Re: Re: Re: Matching arrays?
by matija (Priest) on Mar 06, 2004 at 14:21 UTC
    BTW, that code will return "test failed" not because it is incorrect, but because the strings don't contain what you're matching for...