#!/usr/bin/perl # csv2hash.pl perl csv2hash.pl A test program. # From http://www.perlmonks.org/?node_id=1166649 use strict; use warnings; my %csv2hash = (); my $record = q[12278788, TV & SATELLITE WEEK 11 MAY 2013 GILLIAN ANDERSON DOCTOR WHO NOT RADIO TIMES , http://www.example.co.uk, 12]; $_ = $record; my ($title) = $_ =~ /^.+?,\s*([^,]+?),/; #/ match the title $csv2hash{$_} = $title; use Data::Dumper; print Dumper(%csv2hash); __END__