Perl-Sensitive Sunglasses | |
PerlMonks |
Location of Conditional test effects resultsby chakram88 (Pilgrim) |
on Apr 10, 2007 at 19:13 UTC ( [id://609235]=perlquestion: print w/replies, xml ) | Need Help?? |
chakram88 has asked for the wisdom of the Perl Monks concerning the following question:
Oh revered monks, I come seeking knowledge and wisdom.
Quick description of my 'issue: I can take the same block of code, and move one line (a conditional operator) from one point to another, and I end up with a different result. My Data structure is an AoH, where a Hash element 'could' be an array. The conditonal is testing for the existance of that secondary array. I loop over the AoH. With the conditional operator assignment at the top of my loop, I get the expected results based on the test in the conditional. If I move the conditional assignment to the end of my loop (no data changes within the loop), I get responses as if the conditional were always true. Code whittled down (line marked with <------ is the offending little bugger) Results:
Yes, I know that the eq test is putting up 'undefined' warnings on those $records where the secondary array is not defined. I deal with it in my full code, this is just "narrowed down to the least amount of code to reproduce the problem". P.S. I had a difficult time coming up with an appropriate title, so any suggestions welcome
Back to
Seekers of Perl Wisdom
|
|