You may want to take at a look at Term::ReadKey from CPAN.
From the docs:
The terminal mode function is controlled by the "ReadMode" function, which takes a single numeric argument, and an optional filehandle. This argument should be one of the following:
- 0: (Reset) Restore original settings.
- 1: (Cooked) Change to what is commonly the default mode, echo on, buffered, signals enabled, Xon/Xoff possibly enabled, and 8-bit mode possibly disabled.
- 2: (Cooked-Invisible) Same as 1, just with echo off. Nice for reading passwords.
- 3: (CBreak) Echo off, unbuffered, signals enabled, Xon/Xoff possibly enabled, and 8-bit mode possibly enabled.
- 4: (Raw) Echo off, unbuffered, signals disabled, Xon/Xoff disabled, and 8-bit mode possibly disabled.
- 5: (Really-Raw) Echo off, unbuffered, signals disabled, Xon/Xoff disabled, 8-bit mode enabled if parity permits, and CR to CR/LF translation turned off.
I didn't try it out, but it looks to be exactly what you need.
djw