Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Re: Re: Re: Re: Module to read a dumped file

by broquaint (Abbot)
on Feb 11, 2003 at 16:19 UTC ( [id://234440]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: Re: Module to read a dumped file
in thread Module to read a dumped file

If you're going to be using a simple do() then you need to pass a reference to Dumper() as passing a bare hash results in a list of values being dumped which is not what you want e.g
use Data::Dumper; my %hash = ( 'dataParams', { 'license_feature' => { 'val' => 'geditor' } } ); open DATA, ">whatever.dat"; print DATA Dumper(%hash); close DATA; print "bare hash dump\n", Dumper(do "whatever.dat"); open DATA, ">whatever.dat"; print DATA Dumper(\%hash); close DATA; print "reference dump\n", Dumper(do "whatever.dat"); __output__ bare hash dump $VAR1 = { 'license_feature' => { 'val' => 'geditor' } }; reference dump $VAR1 = { 'dataParams' => { 'license_feature' => { 'val' => 'geditor' } } };
So as you can see when you dump by reference you get back the complete data structure.
HTH

_________
broquaint

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-25 10:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found