Pathologically Eclectic Rubbish Lister | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
It would be helpful if you described how your program isn't working. I gave this a run on my machine and it seemed every file and directory was printed as a match. Is that what you're experiencing? As far as insight, I think you'll find putting use strict; at the top of your script (and use warnings;) will help a lot. It reports:
The array @patterns is a separate variable from the scalar $patterns, which you're using in your "if" statement. You'll probably want something along the lines of:
Having said that, I see a second problem in the format of your search patterns. They aren't regular expressions, they're shell-like globs. For example, *\PL\* is not a valid regex; you'd want .*\PL\.*. In reply to Re: Using an array that contains wildcard characters for pattern matching.
by crashtest
|
|