I get to the filename with this:
foreach my $g (@gists) { my @files = keys(%{$g->{files}}); my $file = $files[0]; # $file is now main.html ... }
One final note. The code quoted from the OP works as commented if and only if there is exactly one key in the 'files' sub-hash (and, of course, the name of the key is 'main.html'). If there are two or more keys, the 'order' of keys in the hash is not guaranteed whatsoever, so 'main.html' might be at index 0, index 1, ...
In reply to Re: can't use certain hashnames when traversing a slightly complex hash
by AnomalousMonk
in thread can't use certain hashnames when traversing a slightly complex hash
by gideondsouza
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |