Help for this page

Select Code to Download


  1. or download this
    # a block returning a list of two elements,
    # but perl thinks it's an anonymous hash
    %hash = map { "$_", 2 } @l;
    
    # an anonymous hash, but perl thinks it's a block
    @hash_refs = map { $_, 2 }, @l;
    
  2. or download this
    # force parsing as a block
    %hash = map { +"$_", 2 } @l;
    %hash = map { ; "$_", 2 } @l;
    ...
    
    # force parsing as an anonymous hash
    @hash_refs = map +{ $_, 2 }, @l;