Help for this page

Select Code to Download


  1. or download this
    sub function {
       my $hashref = shift;
    ...
    my %hash = ( one => 1, two => 2 );
    &function(\%hash);
    print join(", ", keys %hash);   # one, two, three
    
  2. or download this
    sub function (%) {
       my %hashref = shift;
    ...
    }
    
    &function(%hash);       # passes %hash as a ref
    
  3. or download this
    sub function {
       my %hash = %{shift};   # de-references
    
       $hash{three} = 3;      # Does not affect the real %hash!
    }