Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
As you can see I am trying to use the splice function,but because it is random, it doesn't work. How do I remove $randomelement from @thumbs? @thumbs is the list of all the pictures in the directory.for($i=1; $i<=$a; $i++){ $randomelement = $thumbs[rand @thumbs]; print "<img src=\"$picture_directory/$randomelement\">$picture_dir +ectory/$randomelement<br>"; splice(@thumbs, $randomelement,1); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: remove a random variable from an array
by Masem (Monsignor) on Apr 19, 2001 at 21:38 UTC | |
|
(ar0n) Re: remove a random variable from an array
by ar0n (Priest) on Apr 19, 2001 at 21:39 UTC | |
|
Re: remove a random variable from an array
by suaveant (Parson) on Apr 19, 2001 at 21:41 UTC | |
by bbfu (Curate) on Apr 20, 2001 at 02:02 UTC | |
by suaveant (Parson) on Apr 20, 2001 at 17:32 UTC | |
|
Re: remove a random variable from an array
by Beatnik (Parson) on Apr 19, 2001 at 21:48 UTC | |
by ar0n (Priest) on Apr 19, 2001 at 22:00 UTC | |
by suaveant (Parson) on Apr 20, 2001 at 17:34 UTC |