## just a sketch my %columns; ## to associate columns with ## column numbers # ## $columns{1} should return ## a reference to the ## first column list { ## closure cleanliness my $seen; ## keeps track of what we have seen ## used to reset hash within closure between runs sub reset_hash{ undef $seen } ##function expects column number sub find_and_dont_actually_remove_but_say_we_did{ my $column_number = shift; my $column = $columns{$column_number}; ## keeping as a reference to ## avoid obscene copy-pasta my $rand; until (not $seen->{$column_number}->{$rand = int(rand(@$column))}){ ## nothing to see here } $seen->{$column_number}->{$rand} = "looks familiar"; return $column->[$rand] } }