Help for this page

Select Code to Download


  1. or download this
    my @array = (
     [ qw( jane  23 teacher ) ],
    ...
     [ qw( larry 19 manager ) ],
     [ qw( wall  23 teacher ) ],
    );
    
  2. or download this
    my @array;
    while( <DATA> ) {
    ...
    jane 23 teacher
    james 20 tailor
    ...
    
  3. or download this
    use constant NAME => 0;
    use constant AGE  => 1;
    ...
        $hash{$aref->[NAME]} = $aref;
      }
    }
    
  4. or download this
    foreach my $name ( sort keys %hash ) {
      local $, = q{, };
      say $name, $hash{$name}[AGE], $hash{$name}[JOB];
    }