in reply to bad index while coercing array into hash
If print Dumper $file; is producing:
$VAR1 = [ { 'longname' => 'drwxr-xr-x 2 1ae2ets fq 4096 Sep 14 + 2007 .', ...
Then you apparently have an AoAoH, not an AoH as you appear to think. So, in order to process the AoAoH, you would need to code something like:
foreach $AoFiles (@files) { foreach $file ( @{ $AoFiles } ) { foreach $t ( keys %$file ){ print "\nt= $t v=" . $file->{$t}; } } ...
Of course, depending how you are obtaining @files, it may well be that the outer loop above will only iterate once. The likely scenario is that you are doing something like:
@files = someSubOrMethodThatReturnsAnAoHReference(); ...
When you should be doing:
$filesRef = someSubOrMethodThatReturnsAnAoHReference(); foreach $file ( @$filesRef ) { print Dumper $file; foreach $t(keys %$file){ print "\nt= $t v=" . $file->{$t}; } ...
|
|---|