Please, clean up your original post by adding <code>...</code> tags around the code,so its more easily readable.
Then specify what errors you are seeing... verbatim!
Update: removed recommendation to insert strict and warnings. OP has 'em, but I blanked on them in the face of the unformatted code. Bad on /me.
Questions containing the words "doesn't work" (or their moral equivalent) will usually get a downvote from me unless accompanied by:
- code
- verbatim error and/or warning messages
- a coherent explanation of what "doesn't work actually means.
check Ln42!
| [reply] |