in reply to How do I extract named variable names from regex string

I like the nice, simple my @items = ($pat =~ m/\?<([a-z]+)>/g) up above, but the "split" comment got me amused so I wrote down
map { s/>.*// } (my @items = split /\?</, $pat) ;
which seems just about cryptic enough, then
my %freq = () ; map { $freq{$_}++ } @items ;
and pull out the keys with value bigger than 1 for duplicates.

I couldn't come up with a way to scan for duplicates all in one line, which is a little disappointing, but maybe there's something clever to do.