Perl: the Markov chain saw | |
PerlMonks |
Re: John Guttag's book - 2nd exercise. My attempt in Perl.by kcott (Archbishop) |
on May 21, 2017 at 06:29 UTC ( [id://1190783]=note: print w/replies, xml ) | Need Help?? |
G'day pritesh_ugrankar, Here's one way to do it:
See Test::More if you're not familiar with that module. It's very useful in situations like this where you want to test a solution against a variety of input data. All those tests passed:
As you can hopefully see, it's very easy to add more test data by simply adding more elements to @tests. — Ken
In Section
Seekers of Perl Wisdom
|
|