open(INPUT, '< your-input-file.txt') or die "Badness: $!"; my (@instructors_array, %instructors_hash); while () { my ($id, $name, $class, $instructor) = split(/!/); push @instructors_array, $instructor; $instructors_hash{$instructor}++; } close(INPUT); my @array_with_every_entry_sorted = sort @instructors_array; my @array_with_distinct_entries = sort keys %instructors_hash;