Actually, that's not the problem at all. If you look at the OP, the first line of output after the "sdf" line shows that @command is in fact being set correctly. I was surprised too, but removing the parentheses and adding use warnings doesn't actually fix the problem.

The real problem, as best I can tell, has to do with connecting to this server using telnet(1) as your client. Somehow telnet is sending some special escapes which your program is choking on. Try adding the following line in "spawn" and you'll see what I mean: print "***$clientreq***\n";

Also, within your while loop you need to add this line, or else it will start spinning forever as soon as your first client disconnects:

last if !defined $clientreq;

Update: By the way, the --debug option in your code won't work the way you think it will. use warnings is lexically scoped, so in fact it will have no effect at all the way you've written it. To see what I mean, try this:

if (1) { use warnings; } print undef;

Note that you don't get an "uninitialized value" warning like you might expect to. One way you can work around this is with:

BEGIN { if ($ARGV[0] eq '--debug') { require warnings; warnings->import(); } }

In reply to Re: Re: Scoping Issue by Errto
in thread Scoping Issue by webdorx

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.