home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!eff!news.oc.com!convex!tchrist
- From: Tom Christiansen <tchrist@convex.COM>
- Subject: Re: Prompting for input
- Originator: tchrist@pixel.convex.com
- Sender: usenet@news.eng.convex.com (news access account)
- Message-ID: <1992Sep8.174308.17093@news.eng.convex.com>
- Date: Tue, 8 Sep 1992 17:43:08 GMT
- Reply-To: tchrist@convex.COM (Tom Christiansen)
- References: <1992Sep8.141620.12312@sbil.co.uk>
- Nntp-Posting-Host: pixel.convex.com
- Organization: Convex Computer Corporation, Colorado Springs, CO
- X-Disclaimer: This message was written by a user at CONVEX Computer
- Corp. The opinions expressed are those of the user and
- not necessarily those of CONVEX.
- Lines: 29
-
- From the keyboard of jim@spitws117.sbil.co.uk:
- :foreach $file (@ARGV)
- :{
- : print "'$command $file'";
- : $ans = getc;
- : exit if $ans eq "q";
- : next COMMAND if $ans eq "n";
- :
- : system $command, $file;
- :}
-
- :This works fine as long as you want to either execute everything or
- :quit part way through, but if you type "n\n" to skip an instance, it
- :skips that instance alright but executes the next one without a
- :pause. It appears to me that there must be something left on STDIN
- :as a result of entering the string "n\n", but I can't find anything
- :in the Camel book about such an occurrence, or how to "suck"
- :everything off STDIN without sending an EOF.
-
- :Does anybody have any idea what's going on and how to fix it?
-
- It's just your friend getc(). Use <STDIN> instead.
-
- --tom
- --
- Tom Christiansen tchrist@convex.com convex!tchrist
-
-
- Disco is to music what Etch-A-Sketch is to art.
-