|Welcome to the Monastery
obvious matching patterns don't matchby Random_Walk (Prior)
|on Aug 18, 2004 at 15:38 UTC
Random_Walk has asked for the wisdom of the Perl Monks concerning the following question:
I am writing a script that takes alerts from Sun hardware and maps part of the error message to an IBM Tivoli error severity (for eventual diplay on Tivoli system management).
Strangely it does not match strings that look to me like obvious matches, it worked when I used a hash to store the mappings (key was pattern, value was mapped severity) but had to change this as processing order is important
I know I must be missing something obvious but I have gone snow blind from staring at it
The following is a reduced test case showing the problem.
Please lead me on the path to enlightenment
And verily did the regexp smite the $2(ites)Many thanks to all for the quick responses, I was looking upstream of my match and completely forgetting the $2 downstream, doh ! Also as beernuts pointed out I should have been using split /:/ in place of the regexp.
I have now re-written it with an array of anon arrays for the mapping, this makes it a lot neater, should have done it that way in the first place.