looks to me like you should be using hashes, not arrays.
I'd do something like this:
use strict;
open(HASH, "testhash.txt") || die;
my $line = <HASH>;
chomp $line;
$line =~ s/'//g;
my %hash = split(/,/, $line);
print "\nEnter the keycode: ";
chomp($line = <STDIN>);
print "Keycode $line has the value $hash{lc($line)}\n" if ($hash{lc($l
+ine)});
Note that this will not match superstrings of valid keycodes, which your code does.
I'm fairly certain that this was not your intent :)
-Ton
Originally posted as a Categorized Answer.