rand()
- From: cybercruiserz@xxxxxxxxx (Bobby)
- Date: Mon, 28 Jul 2008 07:54:29 -0700 (PDT)
Hi all,
How do I use the rand function to print out more than one random number for an array? In the example script below i have an array @nums with a list of numbers; how do i print out more than one random numbers from that list (@nums)? Thanks.
#!/usr/bin/perl
use strict;
use warnings;
my @nums = ("10000","10002","10004","10005","10006","140000","1500000");
my $randnum = $nums[rand(@nums)];
print "$randnum \n";
- Follow-Ups:
- Re: rand()
- From: Chris Charley
- Re: rand()
- From: Jim Gibson
- Re: rand()
- From: Aruna Goke
- Re: rand()
- From: Peng Kyo
- Re: rand()
- Prev by Date: RE: while trying to learn pack
- Next by Date: Re: rand()
- Previous by thread: Pipe print output into shell in debugger
- Next by thread: Re: rand()
- Index(es):