Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^4: Remove node information by searching tag element

by veerubiji (Sexton)
on Nov 23, 2011 at 14:35 UTC ( #939671=note: print w/replies, xml ) Need Help??


in reply to Re^3: Remove node information by searching tag element
in thread remove node information by searching tag element.

Sorry still you didn't understand my problem I think, In the above input data as I provided, in that data number tag is same in first data node and third data node, but reaming information is different only number tag is same. I need to delete the entire node if number tag element is same in any node. I am printing $info into new file so before printing into new file I need to eliminate duplicate nodes by using number tag. I hope now you understand clearly, I posted my expected result also. can you suggest me.

  • Comment on Re^4: Remove node information by searching tag element

Replies are listed 'Best First'.
Re^5: Remove node information by searching tag element
by MidLifeXis (Monsignor) on Nov 23, 2011 at 14:45 UTC

    Given your output data, the approach I provided will do the job. $key should be the 'number tag element'. Don't add the results if you have already seen the number.

    This block of code illustrates the technique.

    my @data = qw( a b 3 d a f b ); my %seen; for ( @data ) { print $_, "\n" unless $seen{$_}++; } __DATA__ a b 3 d f

    You should be able to apply this technique to your problem space.

    --MidLifeXis

      hi I reeded total xml::libxml::reader; but how to extract specific element form resulting $info and how to compare this is repeated or not. please help me i am not able to implement.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://939671]
help
Chatterbox?
[LanX]: I told you the story about the “new" currency trading system of Dresdner Bank
[LanX]: ?
[Corion]: No, or I don't remember the story ;)
LanX my favourite don't tell me the proof of concept is good enough for production anecdote
[ambrus]: ah, it's one of thos
[Eily]: what, there's a difference between proof of concept and production?
[LanX]: 20 years ago traders were complaining about the latency of the trading system...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2017-03-29 11:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (349 votes). Check out past polls.