jonhy has asked for the wisdom of the Perl Monks concerning the following question:
New code that I m using now is:-my $file = "abc.xml"; open INFO, "$file"; my $count=0; $count++ while <INFO>; print Dumper ($count); close INFO; $count=$count-1; $file = "abc.xml"; open INFO, "$file"; my @a=<INFO>; splice (@a, $count,1); #print Dumper (\@a); close INFO; $file = "abc.xml"; open (INFO, ">$file") or die "cannot open file $@"; print INFO @a; close INFO; $file = "abc.xml"; open INFO, ">>$file"; print INFO $xml1; close INFO;
Anymore suggestion if there will be appreciated. Hiteshmy $inp = "abc.xml"; my $out = "new_abc.xml"; open( INP, $inp ) or die "$inp: $!" ); open( OUT, $out ) or die "$out: $!" ); my @array = <INP>; my $xml1 = qq|<sample> <date>$date</date> <server>cardev.ebookers</server> <process_Id>$dirn</process_Id> <ref_key>$r</ref_key> </sample> </test>|; $array[$#array] = $xml1; # replace last line print OUT join "", @array;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Generating xml from Perl
by graff (Chancellor) on May 10, 2005 at 02:36 UTC | |
by jonhy (Initiate) on May 10, 2005 at 03:59 UTC | |
|
Re: Generating xml from Perl
by jdporter (Paladin) on May 10, 2005 at 00:48 UTC | |
by satchm0h (Beadle) on May 10, 2005 at 01:00 UTC | |
by jdporter (Paladin) on May 10, 2005 at 13:25 UTC | |
by Anonymous Monk on May 10, 2005 at 08:06 UTC | |
|
Re: Generating xml from Perl
by gopalr (Priest) on May 10, 2005 at 04:46 UTC |