in reply to whats wrong with this code?
Not answering your question but in the spirit of TIMTOWTDI, just having a play with recursion for the fun of it.
johngg@shiraz:~ > perl -Mstrict -Mwarnings -E ' my @arr = ( 1 .. 10 ); recPrint( @arr ); sub recPrint { @_ ? do { say join q{ }, shift, qq{@_}; &recPrint; } : return; }' 1 2 3 4 5 6 7 8 9 10 2 3 4 5 6 7 8 9 10 3 4 5 6 7 8 9 10 4 5 6 7 8 9 10 5 6 7 8 9 10 6 7 8 9 10 7 8 9 10 8 9 10 9 10 10
Using a while loop is the obvious and simplest way to go though.
Cheers,
JohnGG
|
|---|