It is
Term::InKey you are looking for. This is written in Perl (no compiled components) and only requires/imports Win32::Console. so if necessary, you could bodily include it in your script if you cannot install modules.
CountZero
"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law