So this can take STDIN from something like a pipe also? I'm not necessarily putting the data in via keyboard. Some of it will be piped in, and the program has to do something when it hits a certain character. -jay > -----Original Message----- > From: John J. Trammell [mailto:trammell+tclug at el-swifto.com] > Sent: Wednesday, October 22, 2003 2:24 PM > To: tclug-list at mn-linux.org > Subject: Re: [TCLUG] perl question > > > On Wed, Oct 22, 2003 at 02:12:35PM -0500, Austad, Jay wrote: > > So in perl, how do I read user entered input in character > by character and > > have it do something when a particular key is pressed. Say > I want the > > program to print "You pressed 5!" when I press the number > 5. So I type: > > 12345 > > > > When the first numbers are entered, nothing happens, but as > soon as I press > > 5, the program prints it's output and dies. When I tried > using a while > > (<STDIN>) loop, it didn't seem to read character by > character but rather > > only evaluated all of them after I pressed enter. > > > > perldoc Term::ReadKey > http://perldoc.com/perl5.8.0/pod/perlfaq8.html > > -- > trammell at el-swifto.com 9EC7 BC6D E688 A184 9F58 FD4C 2C12 > CC14 8ABA 36F5 > Twin Cities Linux Users Group (TCLUG) Minneapolis/St. > Paul, Minnesota > > _______________________________________________ > TCLUG Mailing List - Minneapolis/St. Paul, Minnesota > http://www.mn-linux.org tclug-list at mn-linux.org > https://mailman.real-time.com/mailman/listinfo/tclug-list > _______________________________________________ TCLUG Mailing List - Minneapolis/St. Paul, Minnesota http://www.mn-linux.org tclug-list at mn-linux.org https://mailman.real-time.com/mailman/listinfo/tclug-list