Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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
Replies are listed 'Best First'.
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 about the Monastery: (5)
As of 2015-07-30 04:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls