>>>>> "Wytch" == Wytch <[EMAIL PROTECTED]> writes:
Wytch> I thought I was doing quite well but it seems I am picked on by the
Wytch> [non]random script I wrote! It seems to default to the first word in the
Wytch> array.
Wytch> I used rand @array;
Wytch> I think perhaps that I am thinking about it too simply and
Wytch> perhaps I need to involve more math - but I am not good at
Wytch> maths [though I am willing and a quick learner...lol] ! so can
Wytch> anyone point me in the right direction?
That's correct, but if you have a very very very old Perl, you'll need
to add "srand;" at the beginning of your program. Do it just once,
though.
The normal idiom is:
my $one_of_many = $many[rand @many];
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]