in reply to pattern matching

Perhaps because $tail does not have a \n at the end?