Help for this page

Select Code to Download


  1. or download this
    %hash = (
        foo => 'bar',
    ...
    );
    
    (ref() eq 'CODE') && $_ = \$hash{ $_->() } for values %hash;
    
  2. or download this
    %hash = (
        foo => 'bar',
    ...
    );
    
    (ref() eq 'ARRAY') && $_ = \$hash{ $_->[0] } for values %hash;
    
  3. or download this
    %hash = (
        foo => 'bar',
    ...
    );
    
    /^REF:(.+)/ and $_ = \$hash{$1} for values %hash;
    
  4. or download this
    %hash = ();
    for (
    ...
    ) {
        $hash{ $_->[0] } = $_->[1];
    }
    
  5. or download this
    %hash = ();
    %temp = (
    ...
    );
    
    $hash{$_} = $temp{$_} for keys %temp;