in reply to Re: Lewis Carroll's Code
in thread Lewis Carroll's Code
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 regular expressions. Evaluates the BLOCK or EXPR for each element of LIST (locally setting "$_" to each element) and returns the list value consisting 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
Hope that helps
Chris
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Lewis Carroll's Code
by Cody Pendant (Prior) on Jul 18, 2002 at 04:25 UTC | |
by cfreak (Chaplain) on Jul 18, 2002 at 04:32 UTC |