Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: I can't see why this shorthand doesn't behave like the verbose formby isync (Hermit) |
on Mar 25, 2012 at 11:53 UTC ( [id://961481]=note: print w/replies, xml ) | Need Help?? |
@Ken: I think you are right - it's time to look at JSON and SQL.
Today I've found the time to hack together a simple test script that doesn't exhibit the original problem. Here, when the variable is properly declared (or not) and populated in perl context, shorthand and longform behave the same. Also, I've removed the noise of the eval and the defined() check, the latter I threw in anyway down the road when the simple check didn't seem to suffice. In my production code the related_files data comes from a SQL field that is parsed based on the test if($sql->{field}), so I think that there's a slight difference how perl regards this field as defined, existing or true. But I am not so inclined to find out why exactly the shorthand doesn't work. As the more verbose code just works. Also, might also be an unrelated error I am overseeing. I'll post if there's a find in the future.
In Section
Seekers of Perl Wisdom
|
|