You need to stick the line number to the -dl switch.
Also, you could check that $readn isn't 0/$null and use ,wn, instead of ,w, for the $read()


#mircscripting @ irc.swiftirc.net == the best mIRC help channel