in reply to Re: Not a HASH reference error
in thread Not a HASH reference error

Okay, so latest on this saga. I found out that on an older version of Linux running an older version of perl (v5.8.8), I get a warning but the command still executes: Pseudo-hashes are deprecated at /www/was50/bin/awc_db2_mgmt.pl line 56. Now, on a more recent version of Linux running a newer version of perl (v5.10.1), this just blows up. No warning, just errors out. UGGGH HELP!!!

Replies are listed 'Best First'.
Re^3: Not a HASH reference error
by poj (Abbot) on Feb 26, 2016 at 20:15 UTC

    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

    foreach 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"; } . .
    poj

      Thank you, Poj. What is really strange is this works just fine on another RHEL v6 server. But not on this one. Same syntax, everything. I'll try your recommendations and see what happens. Thanks again.