in reply to Re: Modifying order of a hash
in thread Modifying order of a hash
and my output looks like:my %file_attachments = ( '103496-1' => { 'CLVD' => '5678', 'COMP' => '1234', 'FD' + => '0010', 'File' => 'text.txt'}, ); print Dumper(%file_attachments); print "\n"; my %newfile_attachments; my $fn; my %newfile_attachments; foreach $fn (keys %file_attachments) { $newfile_attachments{$fn->{FirstNum}}= $fn; delete $fn->{FirstNum}; } print Dumper(%newfile_attachments); print "\n";
> perl hashofhash.pl "my" variable %newfile_attachments masks earlier declaration in same s +cope at hashofhash.pl line 17. $VAR1 = '103496-1'; $VAR2 = { 'FD' => '0010', 'COMP' => '1234', 'CLVD' => '5678', 'File' => 'text.txt' }; Can't use string ("103496-1") as a HASH ref while "strict refs" in use + at hashofhash.pl line 19.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Modifying order of a hash
by jethro (Monsignor) on Sep 25, 2008 at 21:55 UTC | |
by monaghan (Novice) on Sep 25, 2008 at 23:00 UTC | |
by jethro (Monsignor) on Sep 25, 2008 at 23:37 UTC | |
by monaghan (Novice) on Sep 26, 2008 at 00:11 UTC |