Help for this page

Select Code to Download


  1. or download this
    my @array = ('cow', 'dog', 'cat');
    my $ref_to_array = \@array;
    
    my ($first, $second) = @{$ref_to_array}[0,1]; # prefix
    my $third = $ref_to_array->[2]; # deref operator
    
  2. or download this
    my @LoL = ();      # empty array
    $LoL[0] = [];      # ref to anonymous array
    $LoL[0]->[0] = []; # another ref to anonymous array
    ...
    $LoL[0]->[0]->[1]   = 'It's a bird, it's a plane, it's...';
    # the shortcut
    $LoL[0]->[0][2]     = 'Superman!';