http://www.perlmonks.org?node_id=991011


in reply to Debugging help!

Variables $1, $2, etc. are locally-scoped and they can be invalid after pattern matching. Try rewriting your matches like this:

$1 => $2 if /(.+)\s+\|\s+(PF.{5})/
so usage of these variables should be inside the if(){} block, not near the match.

If you are not sure whether your regexps are right, use Regexp::Debugger or YAPE::Regex::Explain to check them.

Sorry if my advice was wrong.