Help for this page

Select Code to Download


  1. or download this
    Readonly::Hash $myHash => ("key1" = "val1",); 
    $myTempValue = $myHash{"this_key_does_not_exist"};
    
  2. or download this
    if ($myHash{"unknown_if_this_key_exists_yet_or_not"}){
        print "values in list are: @{$myHash{\"unknown_if_this_key_exists_
    +yet_or_not\"}}\n";
    }
    
  3. or download this
    if (exists($myHash{"unknown_if_this_key_exists_yet_or_not"}) and $myHa
    +sh{"unknown_if_this_key_exists_yet_or_not"}){
        print "values in list are: @{$myHash{\"unknown_if_this_key_exists_
    +yet_or_not\"}}\n";
    }
    
  4. or download this
    use strict; 
    no autovivification;    #<-- include in all programs, all the time!
    
    my %myHash =();
    
    print "values in list are: @{$myHash{\"unknown_if_this_key_exists_yet_
    +or_not\"} || []}\n";