[33003] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4279 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 29 05:17:17 2014

Date: Fri, 29 Aug 2014 02:17:04 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 29 Aug 2014     Volume: 11 Number: 4279

Today's topics:
    Re: capture backspace in perl script <klaus03@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 29 Aug 2014 11:12:16 +0200
From: klaus03 <klaus03@gmail.com>
Subject: Re: capture backspace in perl script
Message-Id: <ltpg4u$fa6$1@speranza.aioe.org>

Le 11/08/2014 17:20, sreeeperll@gmail.com a écrit :
> Hi,
>
> I'm writing a perl program, where i need to accept the
> input from the user, i also want to accept the backspace
> and delete chars and take action appropriately. here's
> the program i already tried, but i still couldn't capture
> the del and backspace keys. please share your ideas.
>
> sub is_backsapce()
> {
>      if (($key =~ ['\b']) || ($key == 8)) {
>          print "Entered backspace\n";
>          return 1;
>      }
>      else {
>          print "Entered non-backspace char\n";
>          return 0;
>      }
> }
>

If you are using Windows, you can use Win32Readch, function 
readch_block() like so:

use strict;
use warnings;

use Win32::Readch qw(readch_block);

print "Press a single keystroke:\n";
my $ch = readch_block;

if (ord($ch) == 8) {
     print "Backspace\n";
}
else {
     print "Character '".ord($ch)."' has been pressed\n\n";
}

-- Klaus


---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active.
http://www.avast.com



------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 4279
***************************************


home help back first fref pref prev next nref lref last post