Also like to point out your last example is wrong :P
but nice snippet none the less (Even though I did come here to say what jaytea had said with the $nick alias xD)