my %info; for(@file) { next if /^#/; skip line if it starts with a hash chomp; # remove \n Update ACK! forgot this! Doh! my($name,$val) = split '=', $_, 2; #split line into two # values, on an = sign next unless $val; # make sure you got something $info{$name} = $val; } print "$info{OFFICE} - $info{NAME}\n";