Help for this page

Select Code to Download


  1. or download this
    my @names = qw(name age location); # add do this list whenever
    # make a hash reference and populate it
    @$fields{@names} = ( ... list of corresponding values ...);
    
  2. or download this
    # a normal hash assignment - scalar context
    $field{'name'} = 'Richard';
    # a normal hash assignment - list context
    @field{qw(name age)} = qw(Richard 24);
    
  3. or download this
    use strict;
    my @names = qw(name age location); # add do this list whenever
    # make a hash reference and populate it
    my $fields = {};  # declare $fields being a hash reference
    @$fields{@names} = ( ... list of corresponding values ...);
    
  4. or download this
    $mech->submit_form(
        form_name => $search_form,
        fields      => $fields,
        }
    );