in reply to How do I read a line of text from a file into an array?
Note that this will not match superstrings of valid keycodes, which your code does. I'm fairly certain that this was not your intent :)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)});
-Ton
Originally posted as a Categorized Answer.
|
|---|