in reply to Simulating Drawing From A Bag

Why not just

while (@my_bag > 0) { $x = int(rand(@my_bag)); print splice(@my_bag, $x, 1) . "\n"; }

This avoids the problem that Skeeve has pointed out.