It'd be nice to have a little more data. I think your __DIE__ handler is a great idea, but it's obviously not showing up the error. I can't tell you why. It looks like your code is getting a warning for no reason, but I can't tell you why that is so.
I have occasionally got HASH reference errors for nothing to do with hashes before and it's usually because I've forgotten to close some quotes or put in a semi-colon or whatever.
Nevertheless, I'm curious what your code returns for the following (just drop this in place of the segment you cut'n'pasted for us above):
It's functionally the same. This block is strict compliant and all the interesting values are printed to STDERR so that we can see things as they go on.use Data::Dumper; # Just grabbing the values of these so that # strict will cope with them. my $my_today_int = $today_int; my $my_no_call_requested_days = $no_call_requested_days; my $my_i = $i; my $my_user_id = $user_id; print STDERR Dumper($my_today_int, $my_i, $my_user_id); print STDERR Dumper($my_no_call_requested_days); { use strict; my @today = @{$my_no_call_requested_days->{$my_today_int}}; print STDERR "today:\n", Dumper(@today); my $ref = $today[$my_i]; print STDERR "ref:\n", Dumper($ref); my $employee_id = $ref->{'employee_id'}; print STDERR "employee_id: [$employee_id]\n"; if($employee_id eq $my_user_id) # should be "==" { print "They are the same!\n"; } }
Hopefully rewriting to something like this will help identify the problem. Particularly if the bug is a missing close quote or } or similar above. :)
Hope it helps.
jarich
In reply to Re: Can't use an undefined value as a HASH reference
by jarich
in thread Can't use an undefined value as a HASH reference
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |