Help for this page

Select Code to Download


  1. or download this
    sub my_uniq {
        my $self   = shift;
        my @result = uniq @{ $self->list };
        wantarray ? @result : scalar @result;
    }
    
  2. or download this
    sub my_uniq {
        my $self   = shift;
    
        return uniq @{ $self->list };
    }
    
  3. or download this
    # class method
    sub get_list {
    ...
    
        return @{ $self->list() };
    }
    
  4. 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();