grep(EXPR,LIST)

Evaluates EXPR for each element of LIST (locally
setting $_ to each element) and returns the array
value consisting of those elements for which the
expression evaluated to true. In a scalar context,
returns the number of times the expression was true.

@foo = grep(!/^#/, @bar); # weed out comments

Note that, since $_ is a reference into the array
value, it can be used to modify the elements of the
array. While this is useful and supported, it can
cause bizarre results if the LIST is not a named
array.