in reply to can't use certain hashnames when traversing a slightly complex hash
Works OK for me:
#! perl use strict; use warnings; my @gists = ( { files => { 'main.html' => { language => 'HTML', filename => 'main.html', type => 'text/html', size => 713, raw_url => 'THIS IS WHAT I WANT' } } } ); foreach my $g (@gists) { my @files = keys(%{$g->{files}}); my $file = $files[0]; print $g->{files}->{$file}->{raw_url}; }
Output:
21:28 >perl 472_SoPW.pl THIS IS WHAT I WANT 21:28 >
The only difference a dot in the hash key makes is that the key has to be quoted under use strict.
Can you provide a minimal example that demonstrates the problem you are seeing?
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: can't use certain hashnames when traversing a slightly complex hash
by NetWallah (Canon) on Jan 06, 2013 at 18:54 UTC | |
|
Re^2: can't use certain hashnames when traversing a slightly complex hash
by gideondsouza (Pilgrim) on Jan 06, 2013 at 15:09 UTC | |
by Athanasius (Archbishop) on Jan 06, 2013 at 15:28 UTC | |
by gideondsouza (Pilgrim) on Jan 06, 2013 at 15:33 UTC |