Below I compare two scalars $temp3 which contains the number 27 and $user_id which contains the number 0. When I compare the two I get the HASH reference error. Displayed under the code below is the local $SIG{'__DIE__'} output where I dump values of variables used.The dump shows no undefined HASH reference. Infact where the script dies I am only testing numeric values.

1515 $ref = @{$no_call_requested_days->{$today_int}}[$i]; 1516 $temp2 = $ref->{'employee_id'}; 1517 1518 $temp3 = $user_id; 1519 if ($temp3 eq $user_id) {} 1520 if ($temp3 eq $temp2) {} 1521 1522 $temp3 = $temp2; 1523 1524 1525 if ($temp3 eq $temp2) {} 1526 1527 1528 if ($temp3 eq $user_id) # $temp3 = ref->{'employee_id'} 1529 { 1530 ...



THIS IS THE LOCAL $SIG{'__DIE__'} PRINTOUT
Can't use an undefined value as a HASH reference at /usr/local/www/cgi +-bin/kapc/md2/display_md_calendar.cgi line 1528. $user_id == 0 ref($user_id) == $temp2 == 27 ref($temp2) == $temp3 == 27 ref($temp3) == $ref == HASH(0x8390bf0) ref($ref) == HASH $ref->{'employee_id'} == 27 $ref->{'type'} == Routine --- $i == 0 $today_int == 1041483600 $no_call_requested_days == HASH(0x837ded0) \$no_call_requested_days->{$today_int} == ARRAY(0x8390c38) scalar(@{$no_call_requested_days->{$today_int}}) == 2 @{$no_call_requested_days->{$today_int}}[$i] == HASH(0x8390bf0) ${@{$no_call_requested_days->{$today_int}}[$i]}->{employee_id} == 27 %{@{$no_call_requested_days->{$today_int}}[$i]}->{type} == Routine ---

In reply to Can't use an undefined value as a HASH reference by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.