in reply to Re^2: how can i hold temporary values in a recursive function
in thread how can i hold temporary values in a recursive function

In fact I spent on the order of half an hour playing with the OP's code, but I couldn't figure out what a useful starting condition might be. Revisiting the OP's node I've only just noticed the print "\n\n", viterbi(end, 3); at the end of the large code block. I guess I was misled by the comment 'this part is main part' following the first code fragment into thinking that was the driving code for what followed rather than the 'key part of the code' as, in hind sight, the OP presumably meant. On reflection it's not surprising that my static analysis of the code wasn't getting anywhere fast!

Bottom line? 'Don't attribute to malice what you can account for by stupidity!'

True laziness is hard work

Replies are listed 'Best First'.
Re^4: how can i hold temporary values in a recursive function
by educated_foo (Vicar) on Apr 20, 2010 at 13:18 UTC
    This is useful feedback to the OP; "Add strictures then turn your sketch into real code" is not. Neither the string "use strict;\n" nor some code changes would have made the starting conditions less opaque.