If I'm not mistaken, it's because of your loop structure.
Say that @from_server does indeed suck up all of the data
from the socket (I am not convinced that it does, the suggested
idiom is to loop across
while defined($input = <$socket>)),
then you get the number of lines slurped back as the scalar
value of the assignment. It then loops and attempts to read
from the socket again. Presumably, there is no more data on
the socket, so it sits there and waits for data.
If assigning socket IO to an array works,
and I would recommend using the suggested idiom instead, but
if, you would want:
@from_server=<$socket>;
print @from_server, "\n";
Note that there is no loop.
Update: As
tilly noted, I am sure that it
is your loop structure; what I'm not sure of is if it is
hanging on the first pass because "you can't do that with
sockets" or if it is because, "you can do that," but it is
hanging on the second pass through the loop.
-
HZ
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.