|Pathologically Eclectic Rubbish Lister|
Re^3: Telnet Client/Server: What am I doing wrong?by eyepopslikeamosquito (Bishop)
|on Dec 16, 2012 at 04:30 UTC ( #1009044=note: print w/replies, xml )||Need Help??|
the previous post asked for working examples... it's difficult to cut out brief partsThough it may be difficult, it's a good training exercise for you in learning Perl. The act of creating a small cut-down program should help you focus on and better understand the problem; you may even find you're able to identify the problem and fix it yourself.
BTW, instead of your global NS file handle and the:
claptrap, you should use a lexical file handle ($ns say) and then simply:
For Perl 5.14+ you don't even need use IO::Handle because:
Before Perl 5.14, lexical filehandles were objects of the IO::Handle class, but you had to load IO::Handle explicitly before you could call methods on them. As of Perl 5.14, lexical filehandles are instances of IO::File and Perl loads IO::File for you.
With recent Perls (5.8+), there's no need anymore to confusingly change the (global) default destination for print statements via the old evil one-argument form of select -- for more details, see Perl Best Practices, chapter 10 (I/O) and Perl tip: Buffering and IO::Handle by TheDamian.
Suggest you further read Suffering from Buffering by MJD.
In Section Seekers of Perl Wisdom