in reply to Perl script asking question and staying in a loop

if ($COUNT = 1)
This assigns one to $COUNT, which in turn, is always true. I think you want == not =.

-- Randal L. Schwartz, Perl hacker

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.