TalsiOrah has asked for the wisdom of the Perl Monks concerning the following question:
The problem is that I cannot exit the loop at all unless I press <CONTROL>-C (^C). I thought that it might be trying to terminate just the sensory stub, and then looping back and executing it again. So I moved the "exit if" up into the actual while loop out of frustration, but to no avail. This is a screenie of the output: http://is100.imagesocket.com/images/2012/02/02/2425592-4k99.png I pressed enter twice, then I pressed the ESC key then enter, then finally ^C. That is the right hex for ESC correct? I was really hoping that I could find a way to close/exit the script with having to type into the terminal also. But nothing seems to be working right now. It should be such a simplistic script. I really cannot figure it out. I even tried chomping, and chopping. Help would very much be appreciated. I don't want to end my project before I haven't even started. I am merely a beginner, Thanks for your time ^_^#!/usr/bin/perl -w # sub security; sub sensorium; sub emotion; sub think; sub volition; sub motorium; while (1) { security(); sensorium(); emotion(); think(); volition(); motorium(); } sub security { # security } sub sensorium { # sensorium print "Press ENTER or ESCAPE key: "; $_ = <STDIN>; exit if (/^\027/); } sub emotion { # emotion } sub think { # think } sub volition { # volition } sub motorium { # motorium } #---
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Can't exit, except when I press ^C?
by roboticus (Chancellor) on Feb 02, 2012 at 10:51 UTC | |
by TalsiOrah (Initiate) on Feb 02, 2012 at 15:18 UTC | |
|
Re: Can't exit, except when I press ^C?
by Anonymous Monk on Feb 02, 2012 at 05:22 UTC | |
by TalsiOrah (Initiate) on Feb 02, 2012 at 15:21 UTC | |
|
Re: Can't exit, except when I press ^C?
by Anonymous Monk on Feb 02, 2012 at 15:13 UTC | |
by TalsiOrah (Initiate) on Feb 02, 2012 at 15:25 UTC | |
by Anonymous Monk on Feb 02, 2012 at 16:20 UTC | |
by Anonymous Monk on Feb 02, 2012 at 23:58 UTC | |
by TalsiOrah (Initiate) on Feb 03, 2012 at 15:21 UTC |