Line 17 looks like some part of your problem: If -- as appears from your use of qx() -- you're trying to use the system grep,
Use grep to search file Search /etc/passwd for boo user: $ grep boo /etc/passwd You can force grep to ignore word case i.e match boo, Boo, BOO and all other combination with -i option: $ grep -i "boo" /etc/passwd
But, as is in your code, methinks the system will eat the $pattern.
once you solve passing the var, this may be helpful: another *nix grep discussion points out that...
-e PATTERN, --regexp=PATTERN Use PATTERN as the pattern....
OTOH,you may find it useful (and more perl-ish) to user Perl's own grep which uses this syntax (from perldoc -f grep):
@foo = grep(!/^#/, @bar); # weed out commentsIn that case, I think you would do well to use qr at line 5.
Update: nobody home when the now-striken sentence was written. Echhh!
In reply to Re: Passing Regex Pattern in Subroutine
by ww
in thread Passing Regex Pattern in Subroutine
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |