shouldn't it be written as this to aviod that confusion:
my $RandomScript = $Scripts[rand(@Scripts)];
> -----Original Message-----
> From: Felix Geerinckx [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 05, 2002 11:18 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Thanks - Re: Regex problem extracting middle-word part of
> string
>
>
> > I didn't quite see why you would have to do a +1 on the following:
> >
> > my $RandomScript = $Scripts[int(rand($#Scripts + 1))];
>
> The '$#array' construct returns the index of the last element of the
> '@array'. 'rand $number' returns a random number between 0
> (inclusive)
> and $number (exclusive). the 'int' function throws away the
> fractional
> part.
>
> If you don't add 1, you would never get the last array-element.
>
> --
> felix
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
----------------------------------------------------------------------------
--------------------
The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]