while ($line = ) { chomp $line; next if $line =~ /^$/; next if $line =~ /[#{}]/; $line =~ /^\s*(\S+)\s*(\S+)/; # new portion $host[$counter]{$1} = {$2}; }