Help for this page

Select Code to Download


  1. or download this
    my %hash;
    populate_hash(%hash);
    ...
      my %h = @_;              # Makes a COPY of the paramter
      %h= (k1=>'v1', k2=>'v2); # Populates the LOCAL %h, not '%hash'
    }
    
  2. or download this
     my %hash = populate_hash( ); # Option 1: Use the Return value
    
    ...
      my ($href) = @_;              # Makes a COPY of the reference
      $href= {k1=>'v1', k2=>'v2}; # Notice - using CURLY brackets, not par
    +ens. This creates a Hash ref.
    }