in reply to Executing a subroutine in an IF
You want double-quotes: "\cR"
And you cannot read a control-r just like that. You need to put your terminal into raw mode which you can do via Term::ReadKey:
use strict; use Term::ReadKey; ReadMode 4; # raw mode my $key = ReadKey(0); # read a character ReadMode 0; # back to normal mode if($key eq "\cR") { # do whatever you want to do print "got ctrl-R!\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Executing a subroutine in an IF
by david_l (Initiate) on Jun 16, 2012 at 08:43 UTC | |
by david_l (Initiate) on Jun 16, 2012 at 08:47 UTC |