- 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.
- or download this
sub clean_list {
...
}
}
- 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;
- or download this
sub clean_array
{
...
@{$_[0]}=keys %hash;
}
- or download this
open(IN, '<', 'myfile') or die "Could not read file\n";
my @initial_array = <IN>;
...
print OUT @initial_array;
close OUT;