Why you sometimes need to use www. in your domain

I always ranted about people using the www.-subdomain for their sites. While it makes the URL unnecessarily longer it doesn't give any advantage.

Wrong. If you have subdomains they would get all the cookies that are set on your main domain.

I have something at the back of my mind about cookies working on subdomains only if the host is ».domain.tld« and not for »domain.tld« though I'm not sure.

Edit: I just checked and it submits the cookie even if there's not ».« in the beginning.