Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
When I load the file and try to print the value for caroline I get the following error:"caroline" 30 "andrew" 10
file created with following code:open DATAFILE, "<somedata" or die "Cannot open datafile: $!"; %some_new_hash = <DATAFILE>; print keys %some_new_hash; # This works fine print $some_new_hash{"andrew"}; # Causes Error
use Data::Dumper; my %some_hash = ( andrew => 10, caroline => 30 ); $Data::Dumper::Terse = 1; $Data::Dumper::Indent = 1; $Data::Dumper::Useqq = 1; open DATAFILE, ">somedata" or die "Cannot open datafile: $!"; print DATAFILE Dumper %some_hash;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: uninitialized value loading into hash and printing
by liz (Monsignor) on Sep 17, 2003 at 11:20 UTC | |
|
Re: uninitialized value loading into hash and printing
by broquaint (Abbot) on Sep 17, 2003 at 11:15 UTC | |
|
Re: uninitialized value loading into hash and printing
by demerphq (Chancellor) on Sep 17, 2003 at 15:53 UTC |