i have stored in htable a key_value=0 with key_type=1, i.e., string.
then i have this piece of test code:
if (defined($sht(htable=>$var(carrier_key)::id))) { xlog("L_INFO", "$sht(htable=>$var(carrier_key)::id) is defined\n"); } else { xlog("L_INFO", "$sht(htable=>$var(carrier_key)::id) is NOT defined\n"); }; $var(carrier_id) = $sht(htable=>$var(carrier_key)::id); if ($var(carrier_id) == (int)0) { xlog("L_INFO", "$sht(htable=>$var(carrier_key)::id) is not found\n"); } else { xlog("L_INFO", "$sht(htable=>$var(carrier_key)::id) is found\n"); };
and when the piece is executed, this is printed to syslog:
Oct 15 12:20:33 squeeze /usr/sbin/trunk-proxy[2915]: INFO: 0 is defined Oct 15 12:20:33 squeeze /usr/sbin/trunk-proxy[2915]: INFO: 0 is not found
i understand the first line, because the entry is in the htable, but how is it possible that string "0" is equal to int 0?
-- juha