Name,Cost,Inventory pickles,2.99,12 vegemite,4.00,8 nuclear sub,22.50,4 #### open IN, "MyCSV.csv" or die "Cannot open input file: $!\n"; my ($line, @colNames, $size, %columns, $j); $j = 0; chomp($line =); # Read the column header @colNames = split(',',$line); $size = scalar @colNames; while($line = ) { chomp($line); push @{$columns{$colNames[$j++ % $size]}}, $_ for(split(',', $line)); } # Now I can play with whole columns of data by name print “Total Inventory = ”, List::Util::sum(@{$columns{'Inventory'}}), “\n”; print “Total Cost = ” , List::Util::sum(@{$columns{'Cost'}}), “\n”;