Just another Perl shrine | |
PerlMonks |
Re^3: Odd number of elements in anonymous hashby Athanasius (Archbishop) |
on Jun 09, 2016 at 16:23 UTC ( [id://1165236]=note: print w/replies, xml ) | Need Help?? |
Yes, actually $attached is a single string whether $code is true or false: in the latter case, it’s the empty string. And that means you get a key/value pair in which the string $attached is the key, and the value is undef — which gives the “Odd number of elements” warning. The solution is to eval the string:
Output:
Hope that helps,
In Section
Seekers of Perl Wisdom
|
|