in reply to eq evaluates a variable as equal to two different strings

Looks like an overload. So what is $info{$key}, where does it come from?

Try this

use Devel::Peek; Dump $info{$key};
And post the output on the forum.

Replies are listed 'Best First'.
Re^2: eq evaluates a variable as equal to two different strings
by landru27 (Initiate) on Jan 30, 2015 at 21:57 UTC

    Sure thing. $info{$key} is populated from some JSON fetched from an API call, then decoded, then parsed into perl data objects for handy use within my program.

    Here is the output from that added Dump call, just above the output I included before:

    SV = PVIV(0x1604e78) at 0x161f2e8 REFCNT = 1 FLAGS = (ROK) IV = 0 RV = 0x14b87a0 SV = PVMG(0x13d6ec0) at 0x14b87a0 REFCNT = 16 FLAGS = (PADMY,OBJECT,IOK,OVERLOAD,pIOK) IV = 0 NV = 0 PV = 0 STASH = 0x1438a90 "JSON::PP::Boolean" PV = 0x14b87a0 "" CUR = 0 LEN = 0 [false] [66616c7365] [] [1] [1]

    I take it that the presence of "OVERLOAD" among the flags confirms your suspicion. In parallel with posting this, I'll start reading what I can find, based on the hints in this additional output. Devel::Peek is new to me. Thanks for the pointer.

      Well, a quick read on how to interpret Devel::Peek info suggests that the output here explains why I was confused : the original value is not what it seemed it was, despite a variety of debug output to the contrary.

      I also (think) I see why the unpack() + pack() pair of calls have the 'magical' effect that they are having.

      The main thing for me is that this is no longer a mystery. I can see clearly how to work with the data, and why it is necessary. And, I learned something new.

      Thanks again for the "finger pointing at the Moon".