Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: removing perldata , hashref from XML file

by choroba (Cardinal)
on May 13, 2020 at 11:01 UTC ( [id://11116749]=note: print w/replies, xml ) Need Help??


in reply to Re^2: removing perldata , hashref from XML file
in thread removing perldata , hashref from XML file

You don't have to introduce the structure. Just use the return value of $tap3->structure.

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^4: removing perldata , hashref from XML file
by SaraMirabi (Novice) on May 16, 2020 at 04:30 UTC

    Hi,

    Many Thanks for answering me, would you mind please give me a guide where in the code i should add the return value?

    !/usr/bin/perl -w use strict; use warnings; use Data::Dumper; use XML::Dumper; use TAP3::Tap3edit; $Data::Dumper::Indent=1; $Data::Dumper::Useqq=1; my $dump = new XML::Dumper; use File::Basename; my $perl=''; my $xml=''; my $tap3 = TAP3::Tap3edit->new(); foreach my $file(glob 'X*') { my $files= basename($file); my $filename=$files.".xml\n"; print $filename; $tap3->decode($files) || die $tap3->error; $perl = $tap3->structure; $dump->pl2xml($perl, $filename); }
      ... where ... i should add ...

      map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

      You misunderstand. This is choroba's code "signature" on PerlMonks.

      c:\@Work\Perl\monks>perl -wMstrict -e "print map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1], +[{}],[sub{}^*ARGV,3] " JApH,
      JApH stands for Just Another Perl Hacker. :) Please consider the advice given in the body of choroba's reply.


      Give a man a fish:  <%-{-{-{-<

        Oh yeah, I am so new to perl. I updated my code :-(

      You've just re-posted the code from your first node, it looks like you haven't even tried to incorporate the suggested code. You'll tend to get better responses if you show your efforts. Also, see this: when you edit a node, make sure to mark your updates, so that replies aren't confusing.

      Anyway, as choroba and I said, the code I showed is a replacement for XML::Dumper, and my example $data can be removed and your $perl variable can be used instead.

        Accept my apalogies. I promise it will never happened again.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-04-20 08:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found