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"; }
In reply to Re: Executing a subroutine in an IF
by morgon
in thread Executing a subroutine in an IF
by david_l
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |