use Set::Scalar; sub Set::Scalar::Base::has_re { my $self = shift; my @has; foreach my $el (keys %{$self->{'elements'}}) { push @has, $el =~ /$_/ for @_; } return wantarray ? @has : "@has"; } my $s = Set::Scalar->new('a','b','c(d)'); if(my $sub_el = $s->has_re(qr/c\((.+)\)/)) { print "found it $sub_el\n"; } __output__ found it d