Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Seaching for text in string and comparing to xml, if not found print text

by tobyink (Abbot)
on Feb 14, 2013 at 08:16 UTC ( #1018699=note: print w/ replies, xml ) Need Help??


in reply to Seaching for text in string and comparing to xml, if not found print text

My general technique would be to start by extracting a list of all ALARM_ID strings from the XML file. Because of the size, assuming the XML is fairly predictable, it might be best to do this with a simple regular expression. Then use map to convert that list to a hash where the ALARM_ID strings are the keys and the values are all "1".

Then loop through the text file, line by line. Extract the alarm ID from the line; if it's in the hash described in the previous paragraph, then print "Success\n" as output; otherwise, print the line as output.

package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name


Comment on Re: Seaching for text in string and comparing to xml, if not found print text
Select or Download Code
Re^2: Seaching for text in string and comparing to xml, if not found print text
by helpneeded (Initiate) on Feb 14, 2013 at 10:17 UTC
    Can you give me a short example? I am not too farmiliar with the map function, I have not yet used it.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1018699]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2014-09-24 02:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (244 votes), past polls