Your match is not greedy. You're just looking for a match on every line of every file. Get rid of the parenthesized portion of your pattern, and use a hash to keep track of what you've already matched.
In reply to Re: Match a string only once in a file
by Roy Johnson
in thread Match a string only once in a file
by newbie2perl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |