in reply to print_r or var_dump?

OF course there ist ;-)
use Data::Dumper; # ... %some_complicated_hash = (); # fill hash with values... print Dumper(\%some_complicated_hash);
That should pretty much do what you want plus you get valid perl code from it.

Regards... Stefan
you begin bashing the string with a +42 regexp of confusion

Replies are listed 'Best First'.
Re: Re: print_r or var_dump?
by mamut (Sexton) on Oct 09, 2001 at 18:15 UTC
    -=- MamuT -=-
    Another feature is if you write it to file.
    use Data::Dumper; my $conf = ( foo => 'foofoo', bar => 'barbar', ); open CONF,"myconfig.conf"; print CONF Dumper($conf); close CONF;
    In another program you make it easy to load it back to Perl.
    my $VAR1; #you must declare VAR1 from file if you use strict open CONF,"myconfig.conf"; my $conf = eval (join "",<CONF>); close CONF;
    Now you have stored structure in $conf. Same you can do with perl object.

    Mamut