in reply to remove a random variable from an array

Simple, assign the random index to a variable and splice using that variable:
for (1..$a) { my $foo = rand @thumbs; my $randomelement = $thumbs[$foo]; my $url = "picture_directory/$randomelement"; print qq(<img src="$url">$url<br>); splice(@thumbs, $foo, 1); }

Update: hooray for redundancy!

ar0n ]