Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re^3: Odd hash problem

by imp (Priest)
on Feb 23, 2007 at 16:05 UTC ( #601756=note: print w/replies, xml ) Need Help??

in reply to Re^2: Odd hash problem
in thread Odd hash problem

That depends on how the hash was stored.

You could use Storable to freeze/thaw the hash like this:

use strict; use warnings; use Storable qw(freeze thaw); use Data::Dumper; my %orig = ( 1 => 2, a => 'b'); my $frozen = freeze(\%orig); print "Frozen: $frozen\n"; my $restored = thaw($frozen); print "Thawed: ", Dumper $restored;
Or you could be lazy (and insecure) and use Data::Dumper and eval like this:
use strict; use warnings; use Data::Dumper; $Data::Dumper::Purity = 1; $Data::Dumper::Terse = 1; my %orig = ( 1 => 2, a => 'b'); my $frozen = Dumper(\%orig); print "Frozen: $frozen\n"; my $restored = eval $frozen; print "Thawed: ", Dumper $restored; print "Error: $@\n";

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://601756]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2018-02-21 15:44 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (283 votes). Check out past polls.