Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Code efficiency ?

by Improv (Pilgrim)
on May 01, 2003 at 15:18 UTC ( [id://254674]=note: print w/replies, xml ) Need Help??


in reply to Efficiently inserting XML data

#!/usr/bin/perl -w use strict; open(READ, "test.xml") || die "Error opening test.xml: $!\n"; open(WRITE, ">new.xml") || die "Error opening new.xml: $!\n"; while(<READ>) { if( $_ eq q{<!-- Testing XML -->}) { print WRITE <<"EWRITE"; <bar> <name> TEST </name> <type> Foo </type> <!-- PDP Status --> <unknown_sec> 0 </unknown_sec> </bar> EWRITE } if($_ eq "</ Test Tag>/) { print WRITE <<ETT; <bar><value> TEST </value> </bar> ETT } if($_ eq "</v></row>\n") { s/\<\/row\>\n$//; $_ .= "<v> UnKnown </v></row>\n"; } print WRITE; } close(READ); close(WRITE);

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-24 23:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found