#!/usr/bin/perl -wl use strict; # Explicit lists of keys and values my %foo; # Note the '@' in front of the hash name! @foo{1..26} = "a".."z"; print $foo{10}; # Prints 'j' # You can use hash slices to return a list, too: print @foo{qw/8 5 12 12 15/}; # Prints 'hello' # You can use it to associate lists: my @employee_names = qw/Joe Jane Jim Jessie/; my @employee_ids = qw/1234 1235 1236 1237/; my %empl_lookup; @empl_lookup{@employee_ids} = @employee_names; # Now, you can look up employee names by ID: print $empl_lookup{1236}; # Hi there, Jim!