in reply to Re: Cut n' paste monkey on my back
in thread Cut n' paste monkey on my back
That was the first thing I though of also, although I would write it like this:
$found{$1}++ while /($foo|$bar|$baz)/go;
The only problem in general is that $foo and company cannot contain any "special" regular expression character...it will work, but they will return the match, not the original search, i.e. $foo = "ba.t" would create keys of "bart", "bast", and "bait". Still, if you know your input file well enough to avoid them, a simple hash increment is definitely a smooth way to do it.
|
|---|