Using references to a hash. : Hash Reference « Hash « Perl






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

1.Hash References
2.Dereferencing hash
3.Anonymous Hash References
4.Get hash value by using the hash reference
5.Get key value pair through hash reference
6.Reference for hash
7.Hard References-Pointers
8.Using -> opertor with hash reference variable
9.Using each function with hash reference
10.Using keys function with hash reference variable