Help for this page

Select Code to Download


  1. or download this
    my @array = qw/one one two/;
    
    # your algorithm
    ...
    print @uniques;
    # prints 'two'
    # and I would expect 'onetwo'
    
  2. or download this
    my %count = ();
    my @uniques = grep {! $count{$_}++} @array;