in reply to Need Example of Saving and Retrieving Hash from File
Here's a crude example:
But look at the contents of 'save' to see what eval is actually evaluating.use Data::Dumper; my %hash = ( foo => 1, bar => 2, baz => 3 ); open my $out, '>', 'save' or die $!; print $out Dumper(\%hash); close $out; open my $in, 'save' or die $!; my $h = eval do { local $/; <$in> }; close $in; print "$_ => $h->{$_}\n" for keys %$h;
the lowliest monk
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Need Example of Saving and Retrieving Hash from File
by Tanktalus (Canon) on Mar 29, 2005 at 00:28 UTC | |
by tlm (Prior) on Mar 29, 2005 at 00:45 UTC |