== used to compare numbers. Use eq to compare strings:
if ($tmpvar eq $regex_array[$i])
In addition, you go to the end of the regex_array loop in the for loop:
for ($i=0; $i < $tmparraylength ;$i++) ^ this must not be <=
Finally, you work too much. Use a hash, it automatically "removes duplicate keys."
my %temp_hash; while (scalar(keys %temp_hash) < number_of_things_you_want) { $temp_hash{$pass->randregex($regex_from_file)}++; } @regex_array = keys %temp_hash;
source share