my %relays; while (<>) { chomp; my ($id, $states) = split(' ', $_, 2); $relays{$id} = $states; }