#!/usr/bin/perl use strict; use warnings; open FILE, 'name_of_file' or die "Could not name_of_file for reading: $!\n"; my %hash; while () { if (/^(\w+)\s+([\w,=]*)$/) { $hash{$1} = $2; } }