Using references to a hash.
#!/usr/bin/perl
%month = (
'01', 'Jan',
'02', 'Feb',
'03', 'Mar',
'04', 'Apr',
'05', 'May',
'06', 'Jun',
'07', 'Jul',
'08', 'Aug',
'09', 'Sep',
'10', 'Oct',
'11', 'Nov',
'12', 'Dec',
);
$pointer = \%month;
printf "\n Address of hash = $pointer\n ";
foreach $i (sort keys %$pointer) {
printf "$i is $$pointer{$i} \n";
}
Related examples in the same category