Dr.Ruud wrote:
Richard Lee schreef:
$pattern = '.*(?:' . join('|', @ARGV) . ')';
Safer:
$pattern = '.*(?:' . join('|', map quotemeta, @ARGV) . ')';
And I would do a qr() on top of that.
} else {
$pattern = join('', map{"(?=.*$_)"} @ARGV);
}
print "\$pattern is $pattern\n";
[EMAIL PROTECTED] ~]# ./faqgrep -or list
$pattern is .*(?:list)
---------------------- breaking it down on my own------------------------
@_ = shift @ARGV ==> should be 'list'
map{"(?=.*$_)"} ==> positive look ahead on anything followed by
pattern 'list'
join() ==> shoudln't it be just 'list' ??
but when I print it, I get .*(?:list).... why???
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/