![]() |
|
Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: I need help with some recursionby tobyink (Abbot) |
on Dec 08, 2012 at 11:18 UTC ( #1007888=note: print w/replies, xml ) | Need Help?? |
To do recursion you really need to do your work in a function. That way, the function can call itself - recurse. Right now the only function you have is a small helper, uniq and you're not doing the bulk of your work in a function. Anyway, here's how I'd do it...
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
In Section
Seekers of Perl Wisdom
|
|