Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2014-07-25 06:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (169 votes), past polls