Help for this page

Select Code to Download


  1. or download this
    %hash;                 # a hash
    $hash{$foo} = 'bar';   # used in scalar context
    ...
    $hash{@ary}++;         # key is scalar(@ary) here: $hash{3} == 1;
    @hash{@ary} = (1,2,3); # hash is now (foo=>1,bar=>2,baz=3)
    @hash{@ary}++;         # $hash{baz} == 4; # why?
    
  2. or download this
    @hash{@array} = (1) x scalar(@array);