How can I generate an array in Perl with 100 random values, without using a loop?
I have to avoid all kind of loops, like \"for\", foreach\", while. This is my exerc
its ugly, but it works. the foreach is just to show that it does.
#!/usr/bin/perl
rand1();
$idx = 1;
foreach $item (@array) {
print "$idx - $item\n";
$idx++;
}
exit;
sub rand1() {
rand2();
rand2();
rand2();
rand2();
}
sub rand2() {
rand3();
rand3();
rand3();
rand3();
rand3();
}
sub rand3() {
push @array, rand;
push @array, rand;
push @array, rand;
push @array, rand;
push @array, rand;
}