#!/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 $_ = or die "Empty file"; chomp((undef, undef, @fields) = (split /\t/)); # Grab the rest, and populate the hashref while () { chomp(); my ($user, @userdata) = (split /\t/); $data->{$user}{$_} = shift @userdata for (@fields); } close DATA;