Help for this page

Select Code to Download


  1. or download this
    Make a subroutine that removes duplicates from a list. If the list is 
    +passed as an array, then return a clean list. If the list is passed a
    +s a reference to an array then clean the given array in place.
    
  2. or download this
    sub clean_list {
    
    ...
               }
        }
    
  3. or download this
    open(IN, '<', 'myfile') or die "Could not read file\n";
    my @array_with_duplicates = <IN>;
    ...
    print OUT @array_no_duplicates;
    close OUT;
    
  4. or download this
    sub clean_array 
    {
    ...
      @{$_[0]}=keys %hash;
    }
    
  5. or download this
    open(IN, '<', 'myfile') or die "Could not read file\n";
    my @initial_array = <IN>;
    ...
    print OUT @initial_array;
    close OUT;