Perl: the Markov chain saw | |
PerlMonks |
Re: How to get this not the usual round robin loopingby kcott (Archbishop) |
on Oct 13, 2015 at 05:59 UTC ( [id://1144620]=note: print w/replies, xml ) | Need Help?? |
G'day fidda, This does what you want:
Output:
Note that this code destroys @B. If you need to keep it, make a copy and use that in the while condition and when calling &build_hash:
Furthermore, the subroutine &build_hash has no reliance on the initial values of either @A or @B. For example, these initial values:
produce this output:
— Ken
In Section
Seekers of Perl Wisdom
|
|