in reply to How to return a list using recursion?
Well, this isn't something you should use recursion for
#!/usr/bin/perl -- use strict; use warnings; use Data::Dump; use List::AllUtils qw' natatime '; my @x = ('a' .. 'z'); my $it = natatime 5, @x; my @yo; while (my @vals = $it->()) { push @yo, "@vals,\n"; } chomp $yo[-1]; chop $yo[-1]; dd \@yo; __END__ [ "a b c d e,\n", "f g h i j,\n", "k l m n o,\n", "p q r s t,\n", "u v w x y,\n", "z", ]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to return a list using recursion?
by Athanasius (Archbishop) on Aug 07, 2012 at 04:26 UTC | |
by Anonymous Monk on Aug 07, 2012 at 15:04 UTC | |
by Anonymous Monk on Aug 08, 2012 at 08:32 UTC |