#!/usr/bin/env perl use strict; use warnings; use feature qw (say); use Data::Dump; use Iterator::Simple qw(iter); my $file = q(1204245.csv); my %column; open my $fh, q(<), $file or die $!; while (<$fh>) { chomp; $column{ ( split /,/ )[2] } = undef; } close $fh; dd \%column; # what ever.. say for sort { $b cmp $a } keys %column; say q(--); # or my $iterator = iter( IO::File->new($file) ); while (<$iterator>) { chomp; $column{ ( split /,/ )[2] } = undef; } dd \%column; say for sort { $a cmp $b } keys %column; __END__ karls-mac-mini:monks karl$ ./1204245.pl { banana => undef, baz => undef, wilma => undef } wilma baz banana -- { banana => undef, baz => undef, wilma => undef } banana baz wilma