sub regex { my $res=$string; $res =~ s/(.)(?=.*\1)//g; return $res; }