sub next_multiset { my $self = shift; if ( ! $self->{frequency} ) { print STDERR "must use next_combination() if 'frequency' argument not passed to constructor\n"; return (); } my $data = $self->data(); my $compare = $self->compare(); while ( my @combo = $self->_next_combination ) { my $x = join '', map {scalar($$_)} sort @$data; my $y = join '', map {scalar($_) } sort @combo; next if $self->{'cache_multiset'}{$y}++; return @combo; } $self->{'cache_multiset'} = undef; return (); }