Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Replacing XML Tag name with another

by reisinge (Friar)
on Sep 27, 2011 at 12:21 UTC ( #928077=note: print w/replies, xml ) Need Help??

in reply to Replacing XML Tag name with another

Developing Ratazong's comment:
#!/usr/bin/perl use strict; use warnings; # file given as command line argument my $file = shift @ARGV; die "Usage: $0 <file.xml>\n" unless $file; # step 1: open the file open FH, "<", $file or die "Can't open '$file': $!\n"; # step 2: read the file line-by-line while (<FH>) { # step 3: do the replacements s/<(\/?)H([12])>/<$1Heading $2>/g; # step 4: write the results the STDOUT print; } close FH;
Cheers, j

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://928077]
[ambrus]: herecy! meat (especially ground meat) and tomato together is a great basic recipe for various foodstuff. it's dairy product based sauces and tomato sauce that don't belong together.

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2017-11-22 11:44 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (319 votes). Check out past polls.