develooper Front page | perl.beginners | Postings from October 2009

About the hash case insensitive ~~~

Thread Next
From:
Majian
Date:
October 27, 2009 04:50
Subject:
About the hash case insensitive ~~~
Message ID:
eb686fc70910270450v54572a6gac8be78aafb4fbcb@mail.gmail.com
Hello,all:
I had a question about the perl hash case insensitive .

And I had  this script :
==========================================
#!/usr/bin/perl
use warnings;
%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?

Thanks for any suggestions ~~~

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About