Help for this page

Select Code to Download


  1. or download this
    my %struct = (data => 1, pointers => []);
    my $struct_ref = \%struct;
    
  2. or download this
    my $struct_ref = {data => 1, pointers => []};
    
  3. or download this
    my @array_of_structs = (\%struct1, $struct2_ref, {data => 1, pointers 
    +=> []});
    push @array_of_structs, \%new_struct;
    
  4. or download this
    my $first_data = $array_of_structs[0]{data};
    push @{ $array_of_structs[2]{pointers} }, 'abc', 'def';
    my $third_struct_second_pointer = $array_of_structs[2]{pointers}[1];