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
Another silly method, how about using a tied array that return a random value ?
use strict;
use warnings;
package Tie::RandArray;
use Tie::Array;
our @ISA = ('Tie::StdArray');
sub FETCH { rand; }
package main;
my @rand;
my $object = tie @rand, 'Tie::RandArray';
$#rand=100;
my @a= @somearray;
warn "@a";
Of course the tied array could cache the values, so that a second array would not be needed to have stable values.