in reply to Re^2: CGI Help
in thread CGI Help

grep in Perl is essentially a simple method for filtering a list. I tend to recommend avoiding it while you are still familiarizing yourself with Perl's constructs.

grep allows you to accomplish something like:

my @second; for my $element (@first) { push @second, $element if condition($element); }
in a concise syntax. Simple filtering by a regular expression is a classic use case. If you have side effects or complex tests, then grep may be a bad choice.

#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.