Help for this page

Select Code to Download


  1. or download this
    use Test::More tests => 6;
    
    ...
    is_deeply( [ 1 ], [ values %h ], 'values works' );
    is( $h{undef()}, 1, 'undef key accesses value' );
    is( $h{''},      1, 'empty string key accesses value' );
    
  2. or download this
    package UndefKey;
    sub TIEHASH { bless [], __PACKAGE__ }
    ...
    package main;
    #my %h = ( undef() => 1 );
    tie my %h, 'UndefKey';