my @array = ('one-1', 'two-2', 'three-3', 'four-4', 'five-5'); my %hash = map { split /-/ } @array; print (join ',', keys %hash);