Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!pitt!io!al From: al@ee.pitt.edu (Alan Martello) Newsgroups: comp.lang.perl Subject: why doesn't my usage of "while(<>)" work ? Message-ID: <9231@pitt.UUCP> Date: 16 Nov 90 22:10:53 GMT Sender: news@pitt.UUCP Reply-To: al@ee.pitt.edu (Alan Martello) Organization: Electrical Engineering, Univ. of Pittsburgh Lines: 32 what is wrong with this example ? I want to rsh to another machine, process the output of the command, and then use "while(<>)" just like always. any help appreciated, please post (unless embarassing) or mail. I'm running perl PL 41 on a Sun-3 under SunOS 4.1 compiled with gcc. ******************************************************************* Alan R. Martello Electrical Engineering Dept. al@ee.pitt.edu University of Pittsburgh ******************************************************************* #! /bin/perl # get the host name for the rsh $host = $ENV{'HOST'}; # # THESE NEXT THREE LINES ARE THE OFFENDING ONES # why does this program work only when these are # commented out ? open(WFH, "rsh $host ls |"); while () { print; } close(WFH); # # second while statement should copy stdin to stdout # while (<>) { print; } exit;