in reply to Parsing CSV into a hash

Thanks everyone for the responses, and especially thanks for the examples using the various parsing modules. I now have those to refer to in the future.

I've settled on a simplified version of my original code, incorporating the suggestions from [id://grandfather], as follows:
#!/usr/bin/perl -w use strict; my $datafile = "stuff.csv"; my @fields; my $data; open DATA, "<$datafile" or die "Could not open $datafile:$!\n"; # Grab the first (header) line, discarding the first two fields $_ = <DATA> or die "Empty file"; chomp((undef, undef, @fields) = (split /\t/)); # Grab the rest, and populate the hashref while (<DATA>) { chomp(); my ($user, @userdata) = (split /\t/); $data->{$user}{$_} = shift @userdata for (@fields); } close DATA;
This is much "nicer" than my original, and I'm now a happy vegemite :)

--Darren