Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

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";

Comment on Re^3: Odd hash problem
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2015-10-10 07:40 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (255 votes), past polls