Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
One other question, if I am testing @text with many things, is there a shorter way to write it than copy and pasting the variable name each time?
#!/usr/bin/perl my @text = ("Hi there 11", "Fred blamed me", "17 o clock", "It's snowi +ng hampsters", "Pickles are people too!"); if (@text =~ /11/ || @text =~ /are/) { print "test successfull"; } else { print "We messed something up again";};
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Matching arrays?
by BrowserUk (Patriarch) on Mar 06, 2004 at 11:53 UTC | |
by bageler (Hermit) on Mar 06, 2004 at 16:21 UTC | |
by ysth (Canon) on Mar 09, 2004 at 04:31 UTC | |
by Anonymous Monk on Mar 06, 2004 at 12:14 UTC | |
by Roger (Parson) on Mar 06, 2004 at 15:45 UTC | |
by Anonymous Monk on Mar 06, 2004 at 13:53 UTC | |
by jonnyfolk (Vicar) on Mar 06, 2004 at 14:03 UTC | |
by matija (Priest) on Mar 06, 2004 at 14:21 UTC |