in reply to Big, bad, ugly regex problem

exit if $data =~ /q/i;

Okay, why is "q" illegal in input? It doesn't seem very dangerous to me! ;-) I think you have a problem with your regex but I think "big, bad, ugly" is overstating it. You probably just wanted something more like:

exit if $data =~ /^\s*q\s*$/i;

I couldn't get past this first part so you'll have to rely on the other replies for the rest of it. (:

        - tye (but my friends call me bad names when I act like this)