Hi,

I am learning perl. Here is the script from which I can get the ASCII values from the keyboard entry made by the user.


#!c:\perl\bin -w
# sascii - Show ASCII values for keypresses
use Term::ReadKey;
ReadMode('cbreak');
print "Press keys to see their ASCII values. Use Ctrl-C to quit.\n";
while (1) {
$char = ReadKey(0);
last unless defined $char;
printf(" Decimal: %d\tHex: %x\n", ord($char), ord($char));
}
ReadMode('normal');

But when I execute the script I am getting the following error even after installing the ReadKey.pm into the perl\site\lib.

ERROR:
E:\>perl ET.pl
Can't locate Term/ReadKey.pm in @INC (@INC contains: C:/Perl/lib C:/Perl/site/lib .) at ET.pl line 11.
BEGIN failed--compilation aborted at ET.pl line 11.


Any Light shed in this regard will be admired and appreciated. :eek:

Recommended Answers

All 3 Replies

has to be like installed like this:

perl\site\lib\Term\Readkey.pm

Thanks Kevin for your suggestion, But I did the same installation. But I am getting the error still. Please let me know.

might have something to do with the fact you run the script from the 'e' drive but the perl install is on the 'c' drive? Can you run other scripts on the 'e' drive no problem?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.