in reply to Re^2: Not a HASH reference error
in thread Not a HASH reference error
If you know the pseudo-hashes are empty of data then a simple check and skip might suffice
foreach my $type (@type_order) { print "$log_pre running $action for $type entries\n"; # Iterate over all items of that type my $type_hash = $hashref->{$type}; next unless ref($type_hash) eq 'HASH'; # <-- add
If you are not sure then use
pojforeach my $type (@type_order) { # Iterate over all items of that type my $type_hash = $hashref->{$type}; if ( (ref($type_hash) eq 'ARRAY') && (@$type_hash<2) ){ print "Skipping empty pseudo-hash for $type entries\n"; next; } else { print "$log_pre running $action for $type entries\n"; } . .
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Not a HASH reference error
by briandanderson1977 (Novice) on Feb 26, 2016 at 23:06 UTC |