Think about Loose Coupling | |
PerlMonks |
Re: Argument "" Isn't numeric in numeric eq (==)by kcott (Archbishop) |
on Feb 10, 2014 at 04:56 UTC ( [id://1074188]=note: print w/replies, xml ) | Need Help?? |
G'day ler224, Firstly, some issues I had with your question:
Here's a technique that uses my array of arrays assumption: you can probably modify it for some other data structure (or to take unshown data into account) if my assumption is wrong. You'll see there's no constraint that the inner arrays must have six elements nor additional code targetting specific indices. This is intended to both reduce the amount of code you need to write (and maintain) as well as allowing the number of elements to be modified at some future time without requiring changes to the code. Also note I've added four more test cases: [2,3] (contains neither success or fail cases); [1,1,1,2] (contains both success and fail cases); [] (contains no cases at all); and, [3,2,1] (bad data - odd number of elements).
Output:
-- Ken
In Section
Seekers of Perl Wisdom
|
|