in reply to Re: Problems with grep
in thread Problems with grep
Grep returns scalars, exampleD:\>perl -e"die grep /6/, 3 .. 6,6,6" 666 at -e line 1.
grep returns a list, and in scalar context, the number of elements the expression was true.
In your example, die outputs the list returned by grep:
perl -e "die scalar grep /6/, 3 .. 6,6,6" 3 at -e line 1.
What you did is essentially the same as:
perl -e 'die qw/1 2 3/' 123 at -e line 1.
citromatik
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Problems with grep
by Anonymous Monk on Jan 30, 2009 at 14:58 UTC | |
by citromatik (Curate) on Jan 30, 2009 at 15:11 UTC | |
by ikegami (Patriarch) on Jan 30, 2009 at 15:31 UTC |