SPUG: Perl stdin backspace

Michael R. Wolf MichaelRWolf at att.net
Thu Aug 10 21:42:18 PDT 2006

You state that “none of the backspace keys work”

For what definition of “work”?

Unix/Linux intercepts some keys for its own purposes.  Check your ‘stty –a’
output to see if that’s the case.  Ctl-C, Ctl-D, Ctl-Z are often caught at
this level, and therefore will not be passed as characters.  Therefore, you
will not find them as characters in your STDIN handle.  If your key is
generating a destructive backspace, and thereby preventing the previous
character from being available on STDIN, it’s working as expected.  If this
is the case, you’ll need to realign your description – the backspace key
does, in fact, work (for this definition of “work”).  If you don’t like this
definition of “work”, perhaps you could redefine the erase key via ‘stty
erase undef’.  I’m not sure how to do that from within Perl, but if you try
it from the command line and it works (for your definition of work), you
could investigate how to accomplish it from the inside.
Michael R. Wolf
    All mammals learn by playing!
        MichaelRWolf at att.net 
From: spug-list-bounces+michaelrwolf=att.net at pm.org
[mailto:spug-list-bounces+michaelrwolf=att.net at pm.org] On Behalf Of Thane
Sent: Thursday, August 10, 2006 10:46 AM
To: spug-list at pm.org
Subject: Re: SPUG: Perl stdin backspace

Hi there. Whenever I write a perl script in the Linux environment, if the
user tries to backspace while entering standard input, it seems like none of
the backspace keys work. Delete, backspace, and ctrl-H all fail. I've tried
googling for a solution to this, but I'm at a loss. Can anyone tell me how
to arrange things so that users can backspace while Perl's taking standard

Thank you,

More information about the spug-list mailing list