- or download this
sub my_uniq {
my $self = shift;
my @result = uniq @{ $self->list };
wantarray ? @result : scalar @result;
}
- or download this
sub my_uniq {
my $self = shift;
return uniq @{ $self->list };
}
- or download this
# class method
sub get_list {
...
return @{ $self->list() };
}
- or download this
# client code - variant a
# (client wants values and count)
...
# client code - variant b
# (client just wants the count)
my $uniq_count = scalar uniq $obj->get_list();