oldirtysingh has asked for the wisdom of the Perl Monks concerning the following question:
Hello
Been stuck on this for quite awhile and cannot find anything on this. Hope you guys can help, or send me in the right direction.
I have the code below. But i want to do different actions, probably call some subroutines, depending on the escape sequence. At the moment its a cntrl + A. But how would i have several different exit sequences and then carry out some task depending on what was pressed.
e.g. cntrl + T is pressed run "&t_stuff", cntrl + Q runs "&q_stuff"
while($exp){ $exp->interact(\*STDIN,"\cA"); print "you exited"; }
Something like this....
while($exp){ $exp->interact(\*STDIN,"\cA"); if("escape sequence capture" =~ /\cT/){ &t_stuff; }else{ print "you exited"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using interact()
by InfiniteSilence (Curate) on May 14, 2014 at 20:02 UTC | |
|
Re: Using interact()
by Laurent_R (Canon) on May 14, 2014 at 20:41 UTC | |
|
Re: Using interact()
by oldirtysingh (Novice) on May 14, 2014 at 21:04 UTC |