InMotion Web Site Hosting
InMotion Hosting Home




Node:Hash Literals, Next:, Previous:Hash Variables, Up:Associative Arrays (Hashes)



Literals

"Hash literals" per se do not exist. However, remember that when we evaluate a hash in the list context, we get the pairs of the hash unfolded into the list. We can exploit this to do hash literals. We simply write out the list pairs that we want placed into the hash. For example:

use strict;
my %table = qw/schmoe joe 7.5 1.6/;
would give us the same hash we had in the previous example.

InMotion Web Hosting Customer Support
M-F 8am - 7pm PST
213-239-0050

More information can be found at the InMotion Hosting Main Site