in reply to Hash question

Your code as posted does not compile.

The correct syntax would be:

my %course =( "2CPR2B" => "C Language", "4PL400" => "Perl Language");
Now, to access the %course hash, you need to index it by a key. Hashes require the use of braces "{}" for indexing (aka subscripting). for example,
print $course{"2CPR2B"}, "\n";
Would print out "C Language".

See List value constructors for more information on how to populate hashes, and extract from them.

The "subscripts" section of "perldoc perldata" has information on the syntax of hash subscripts.

             "I'm fairly sure if they took porn off the Internet, there'd only be one website left, and it'd be called 'Bring Back the Porn!'"
        -- Dr. Cox, Scrubs

Replies are listed 'Best First'.
Re^2: Hash question
by spencerr1 (Novice) on Apr 13, 2013 at 18:30 UTC

    Thanks and thanks for the heads up on the perl doc