Hi All,

How do I generate random numbers using arrays in PERL.

Thank you,

Recommended Answers

All 4 Replies

int(rand(10));
   
   
   print rand;

Hi All,

thank you all for your responses, now how do I Insert a random number as the 3rd element in the array

Thanks

my $rand=int(rand(10));
my @array;
$array[2]=$rand;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.