in reply to Re: STDIN Odd Bevahior in Linux Environments
in thread STDIN Odd Bevahior in Linux Environments

No, it isn't related to perl, but it is understandable that you don't know that.

What it is related to is the terminal "emulator" you are using. They vary somewhat, as does the means of dealing with this issue. The reason is that the emulator can capture and modify various key codes.

For example, I use the XFCE Terminal. If I go to Preferences->advanced, there is the option: "Backspace key generates" and the choices include Control-H, which is what you are getting (they also include "Escape sequence", which would be the normative ascii value of backspace, and ascii del, which would make backspace == delete).

Probably you are using the gnome-terminal, but I think if you look around in it you will be able to find something similar. Most likely, your Ubuntu and your RedHat are configured differently. You may have more luck on a linux forum, many people there will understand perl and be more familiar with little OS details like this.

MidLifeXis's suggestion is probably a good one, since the shell is intermediary between the terminal and perl.
  • Comment on Re^2: STDIN Odd Bevahior in Linux Environments

Replies are listed 'Best First'.
Re^3: STDIN Odd Bevahior in Linux Environments
by dolmen (Beadle) on Sep 24, 2009 at 08:39 UTC

    This is not just a terminal emulator issue.

    Terminal settings on Unix was designed at a time where terminals were hardware, so terminal settings must be set on the server side. Or at least unix side settings must match terminal side settings.

    You have two sets of settings on the unix side:

    • line settings defined with stty for the most important control keys (break, sleep, pause...)
    • TERM environment variable which tells all settings for curses applications that use it. This variable is the name of a file in /usr/share/terminfo

    If your TERM variable is correctly set to match your terminal emulator, you can use the terminfo settings to set the line settings in your profile:

    [[ -n "$TERM" ]] && stty erase "$(tput kbs)" susp "$(tput kspd)"