Perl-Sensitive Sunglasses | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I was going to use a foreach loop, but the idiomatic code seemed (and now that I understand it, IS) better for maintainability, given that it hids indexing and is very concise Obviously I needed to understand its workings before employing it en masse; now that it is clear to me I can say that these are the kind of things that make me love perl and I have a new nifty piece of syntax in my arsenal. As for the $test variable, I agree that I could've chosen a better name (maybe $constraints like in the python original code). And given that it is just a one-off script made for fun, it is overkill to use a variable to hold the boolean, but I was influenced by habit (keep complex boolean conditions outside of the if) and by the over complex python code, where they actually create a function for every constraint and then put them in a tuple to map them to each permutation with all(). Thank you for your observations. In reply to Re^2: Help me understand this idiomatic hash from array code
by adhrain
|
|