G
grocery_stocker
Quoting part of perldoc -f grep
"grep BLOCK LIST
grep EXPR,LIST
This is similar in spirit to, but not the same as,
grep(1) and
its relatives. In particular, it is not limited to
using regu-
lar expressions.
Evaluates the BLOCK or EXPR for each element of LIST
(locally
setting $_ to each element) and returns the list value
consist-
ing of those elements for which the expression
evaluated to
true. In scalar context, returns the number of times
the
expression was true.
@foo = grep(!/^#/, @bar); # weed out comments
or equivalently,
@foo = grep {!/^#/} @bar; # weed out comments
"
If @bar is an array, does this get converted to a list automatically?
Chad
"grep BLOCK LIST
grep EXPR,LIST
This is similar in spirit to, but not the same as,
grep(1) and
its relatives. In particular, it is not limited to
using regu-
lar expressions.
Evaluates the BLOCK or EXPR for each element of LIST
(locally
setting $_ to each element) and returns the list value
consist-
ing of those elements for which the expression
evaluated to
true. In scalar context, returns the number of times
the
expression was true.
@foo = grep(!/^#/, @bar); # weed out comments
or equivalently,
@foo = grep {!/^#/} @bar; # weed out comments
"
If @bar is an array, does this get converted to a list automatically?
Chad