in reply to perl grep clone

I have the impression your motivation comes from the desire to emulate grep from command line.

So maybe you want to have a look at -l -a -n -e -p ...(and so on) options in perlrun ?

e.g.

-n

causes Perl to assume the following loop around your program, which makes it iterate over filename arguments somewhat like sed -n or awk:

LINE: while (<>) { ... # your program goes here }

Note that the lines are not printed by default. See -p to have lines printed. If a file named by an argument cannot be opened for some reason, Perl warns you about it and moves on to the next file.

update

As replacement for

grep PATTERN *

try

perl -ne'/PATTERN/&&print' *

for a start. :)

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!