Input on a per-character basis?

Is there a way of getting input from STDIN so that every character is grabbed and evaluated individually? It's no big deal if it isn't, or if the solution is overly complex, but I'd like to avoid the redundant enter-presses if feasible, and since the sort of input is going to be based on the first character typed, getting that character before they press return is the only problem I can think of.

• : Is there a way of getting input from STDIN so that every character is grabbed and evaluated individually? It's no big deal if it isn't, or if the solution is overly complex, but I'd like to avoid the redundant enter-presses if feasible, and since the sort of input is going to be based on the first character typed, getting that character before they press return is the only problem I can think of.

The only thing I can think of is to split the STDIN input. Something like:

@chars = split(//, );

Now the last character will have the newline but you can chomp it off.

X
• : Is there a way of getting input from STDIN so that every character is grabbed and evaluated individually? It's no big deal if it isn't, or if the solution is overly complex, but I'd like to avoid the redundant enter-presses if feasible, and since the sort of input is going to be based on the first character typed, getting that character before they press return is the only problem I can think of.
:
You can probably use the read function, using STDIN as the file handle. Give the length you want to read as 1 to read an individual character.

Jonathan

###
for(74,117,115,116){\$::a.=chr};((\$_.='qwertyui')&&
(tr/yuiqwert/her anot/))for(\$::b);for(\$::c){\$_.=\$^X;
/(p.{2}l)/;\$_=\$1}\$::b=~/(..)\$/;print("\$::a\$::b \$::c hack\$1.");

• Unfortunately that requires a linebreak (or carriage return, or whatever) before it reads. It did however lead me on the trail to a POSIX solution which seems my best bet, but I don't know if that'll work in Win/DOS (if not, I'll probably just check \$^O). There's also the Term::ReadKey module, but that's nonstandard so anybody who wants to run it (assuming anybody -will- want to run it of course) will face dependancy errors, which I don't like. I'm also not entirely sure it doesn't need the linebreak (that's what I'm assuming a non-blocking read means) and it apparantly also had problems with Windows.