open (DATA, "; close (DATA); foreach $rec (@DATA) { chomp $rec; my @vars = split(/\s*,\s*/,$rec); # debug - you might want to join with '|' to see # whitespace in any vars print "VARS = " . join('|', @vars). "\n"; # now insert into the hash $var_hash{$vars[2]} = 'whatever'; }