purple.mojo has asked for the wisdom of the Perl Monks concerning the following question:
given this code:
How do I code this into an "if" statement? So... "if the grep conditions are true, print what's indicated, otherwise print a message that says, "nothing found".@array = qw(apple pear banana orange grape); @array2 = grep {$_ =~ "n"} @array; print "@array2\n";
Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: grep and arrays
by pc88mxer (Vicar) on Apr 14, 2008 at 23:27 UTC | |
|
Re: grep and arrays
by jwkrahn (Abbot) on Apr 14, 2008 at 23:58 UTC | |
|
Re: grep and arrays
by FunkyMonk (Bishop) on Apr 14, 2008 at 23:08 UTC | |
|
Re: grep and arrays
by NetWallah (Canon) on Apr 15, 2008 at 00:07 UTC | |
|
Re: grep and arrays
by apl (Monsignor) on Apr 15, 2008 at 01:10 UTC | |
|
Re: grep and arrays
by j1n3l0 (Friar) on Apr 15, 2008 at 08:42 UTC | |
|
Re: grep and arrays
by Anonymous Monk on Apr 15, 2008 at 14:17 UTC |