oldwarrior32 has asked for the wisdom of the Perl Monks concerning the following question:
Hello, I am new here and noob to Perl too, I would like to ask for some help.
I have this piece of code(I think the full program is not necessary for the matter discused):
my $data= (Dumper $res->valueof('//listPhoneByNameResponse/return/phone'));That part of the program brings the following output:
$VAR1 = { 'model' => 'Cisco 7911', 'name' => 'SEP00229004C80A', 'product' => 'Cisco 7911' }; $VAR2 = { 'model' => 'Cisco 7911', 'name' => 'SEP00229004C851', 'product' => 'Cisco 7911' }; $VAR3 = { 'model' => 'Cisco 7911', 'name' => 'SEP00229004CC92', 'product' => 'Cisco 7911'
I need to parse the output, to create a table. I could make a new program and process all the anonymous hashes, but is there a way to tell the "Dumper" function to bring only one value a time?
Something like this:
print Dumper->${$VAR1}{"model"}; I think you got the idea. Any recomendation to parse a Data::Dumper output would be welcome. Thanks! I just want to say thank you all for your worthfull help. I just forgot about the Dumper module and made some modifications. At the end I just used the Text::Table module for practical purposes and it worked like a charm. Thanks again!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help with Dumping data. Manipulate hashes output.
by MidLifeXis (Monsignor) on Jun 05, 2012 at 17:38 UTC | |
|
Re: Help with Dumping data. Manipulate hashes output.
by BrowserUk (Patriarch) on Jun 05, 2012 at 17:43 UTC | |
|
Re: Help with Dumping data. Manipulate hashes output.
by Cristoforo (Curate) on Jun 05, 2012 at 18:32 UTC | |
|
Re: Help with Dumping data. Manipulate hashes output.
by oldwarrior32 (Sexton) on Jun 05, 2012 at 20:01 UTC |