#!/bin/perl my @csv2 = (); # Creates new empty array @csv2 open CSV2, "; # populates @csv2 array with data from file handle CSV2 close CSV2; my %csv2hash = (); # Creates empty hash csv2hash for (@csv2) { # for data in @csv2 array #chomp; my ($title) = $_ =~ /^.+?,\s*([^,]+?),/; #/define the data which is the title #Indicate that title data will input into csv2hash $csv2hash{$_} = $title; } foreach my $csv2 (keys %csv2hash) { # iterates over all the keys in %csv2hash, assigning each one to $csv2 my $value = $csv2hash{$csv2}; print "$csv2\n"; # This prints the data line by line in the csv2