I don't understand why you are using the $whileloop variable.  Perl
has perfectly good loop control mechanisms.  A quick rewrite would be

while (1) {
       if ($sock) {
               printf "Socket connected\n";
               printf "$counter\n";
               $counter++;
               sleep 2;
       } else {
               last;
       }
}

If it wasn't for the fact I was on the way out the door yesterday, I would probably have noticed that.

However, that being the case, it should also be able to be written this way:

while ($sock) {
               printf "Socket connected :: $counter\n";
               sleep(2);
               $counter++;
}

This is untested however, and I've never used IO::Socket before, so I don't know whether there are any implications.

Steve

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to