in reply to Pattern matching with hash keys
Your syntax is invalid. Instead of = between the key and the value, you need the "fat comma" => as shown below. Does this do what you want?
use strict; use warnings; my %hash = ( "rabbit" => "pap", "triangle" => "tri" ); my $key = "rabbit"; print $hash{$key}; # prints "pap"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Pattern matching with hash keys
by tej (Scribe) on Oct 04, 2010 at 06:24 UTC | |
by eyepopslikeamosquito (Archbishop) on Oct 04, 2010 at 06:49 UTC | |
by prasadbabu (Prior) on Oct 04, 2010 at 06:37 UTC |