in reply to remove a random variable from an array

$picture = splice(@images,int rand($#images)+1,1);
Update:added +1... thx to ar0n

Greetz
Beatnik
... Quidquid perl dictum sit, altum viditur.

Replies are listed 'Best First'.
(ar0n) Re (2): remove a random variable from an array
by ar0n (Priest) on Apr 19, 2001 at 22:00 UTC
    The only problem with this is, is that rand($#images) will never return the index of the last element in @images, since rand EXPR always returns less than EXPR.


    ar0n ]

Re: Re: remove a random variable from an array
by suaveant (Parson) on Apr 20, 2001 at 17:34 UTC
    rand(@images) would also do what you want, without the math...
                    - Ant