while (){ my ($confID, $confPIN) = split ' '; $confID = '' unless defined $confID; ... }