Help for this page

Select Code to Download


  1. or download this
    tie my %hash, 'Tie::Hash::Vivify', sub { 10 };
    say $hash{foo};  # says 10
    my $is_this_true = exists $hash{foo};
    
  2. or download this
    tie my %hash, 'Hash::DefaultValue', sub { 10 };
    say $hash{foo};
    my $is_this_true = exists $hash{foo};
    
  3. or download this
    tie my %hash, 'Hash::DefaultValue', sub { uc };
    say $hash{foo}; # says "FOO"