arrays01.pl to HTML.

index -|- end

Generated: Tue Feb 2 17:54:21 2010 from arrays01.pl 2007/09/04 701.

#!/perl -w
# NAME: arrays01.pl
# AIM: Just some tests with an Array of Arrays
# 04/09/2007 geoff mclane - http://geoffair.net/mperl/
use strict;
use warnings;
# declaring an array of arrays
my @AoA = (
        [ "fred", "barney" ],
        [ "george", "jane", "elroy" ],
        [ "homer", "marge", "bart" ],
      );
# add to an existing row
push( @{ $AoA[0] }, "wilma", "betty");
push( @{ $AoA[2] }, "peter", "paul");
# accessing printing the arrays
foreach my $aref ( @AoA ) {
     prt( "whole [ @$aref ],\n" );
    prt( "1by1  [ ");
    foreach my $k (@{$aref}) {
       prt( "$k " );
    }
    prt("]\n");
}
exit(0);
sub prt {
   my ($m) = shift;
   print $m;
}
# eof - arrays01.pl

index -|- top

checked by tidy  Valid HTML 4.01 Transitional