Perhaps because $tail does not have a \n at the end?
In reply to Re: please help by tybalt89 in thread pattern matching by simon2016