in reply to Re: Re: flip-flop operator and sequence number
in thread flip-flop operator and sequence number
Thats looks like the correct output to me. What were you expecting to see?
Update: Ok. Getting downvotes, so perhaps I'll be a little clearer.
Your array contains the numbers from 1 to 11. Your flip-flop condition is /1/ .. /3/. These are regular expressions and match if the values they are matched against contain this string in any position. Obviously it switches on when it gets to 1 and switches off when it gets to three. It then switches on again when it gets to 10. It would have switched off again had your array gone up to 13.
The problem is therefore not with merlyn's algorithm, but with your implementation of it :)
--Perl Training in the UK <http://www.iterative-software.com>
|
|---|