Thanks all ~ when I type this command "perldoc -f uc", then find this :
uc EXPR uc Returns an uppercased version of EXPR. This is the internal function implementing the "\U" escape in double-quoted strings. Respects current LC_CTYPE locale if "use locale" in force. See perllocale and perlunicode for more details about locale and Unicode support. It does not attempt to do titlecase mapping on initial letters. See "ucfirst" for that If EXPR is omitted, uses $_. On Tue, Oct 27, 2009 at 8:11 PM, Thomas Bätzler <t.baetz...@bringe.com>wrote: > Majian <jian...@gmail.com> asked: > > > > %courses = ( > > "2CPR2B" => "C Language", > > "1UNX1B" => "Intro to Unix", > > "3SH414" => "Shell Programming", > > "4PL400" => "Perl Programming", > > ); > > > > print "\n\"EDP\" NUMBERS AND ELECTIVES:\n"; > > while (($num, $value) = each (%courses)) > > { > > print "-----------------------------\n"; > > printf "%-10s | %s\n ", $num, $value; > > } > > > > print "\nWhat is the EOP number of the course you wish to take : $num"; > > chomp ($num = <STDIN>); > > print "The course you will be taking is: \"$courses{$num}\"\n"; > > ======================================================= > > The question was : > > > > If I type the "4PL400", then it will output the value ---"Perl > > Programming"; > > But I want to type the "4pl400" , and the result should be printed "Perl > > Programming" > > > > How could I come it true? > > Use "chomp ($num = uc(<STDIN>) )" to uppercase the input and make sure that > all your keys are in upper case, too. > > HTH, > Thomas >