What can you do here?
If you are a beginner, or would like to refresh your Perl programming knowledge,
you can go over the Perl tutorial.
You will find a few advanced articles too, though most of the advanced articles are available to the
subscribers of the Perl Maven Pro service only.
If you are interested to listen to or even see other Perl developers,
the Perl Maven TV Show is a collection of such interviews.
Want to make sure you don't miss any of the Perl Maven articels?
Sign up to the newsletter!
Perl has a grep function which is a generalized version of the grep command-line
utility available on Unix/Linux systems. That grep function can filter values from a list of values or an array based on any kind of condition.
This article is not about the grep function.
This article is about finding certain strings in a file, just as the command-line grep does.
How to grep a file using Perl
Often there are cases your Perl application has some default values that can be overridden
by a value in a configuration file or on the command line. The same can be the case
for individual functions in perl that accept arguments. In case the arguments
are not provided, the function will use its default values.
Let's see how to set default values.
How to set default values in Perl