in reply to Reg Ex Needed
should it be a regex?
you can use a hash to hold the data and check if an element has occured more than once.If you need exactly two, try thismy %temp; my @captured = grep { defined $temp{$_}++ } split / /, <DATA>;
my %temp; my @captured = grep { ++$temp{$_} == 2 } split / /, <DATA>;
|
|---|