Help for this page

Select Code to Download


  1. or download this
            sub uniq {
                my %hash = map { $_ => 1 } @_;
                return keys %hash;
            }
    
  2. or download this
            sub uniq {
                return keys map { $_ => 1 } @_;
            }
    
  3. or download this
            sub uniq {
                # two pairs of braces around map
                return keys %{ { map { $_ => 1 } @_ } };
            }
    
  4. or download this
            sub uniq {
                # single pair of braces around map
                return keys %{ map { $_ => 1 } @_ };
            }