Yurttas/PL/SL/perl/F/07/01/01/aa 01.pl

From ZCubes Wiki
Jump to navigation Jump to search
 1# 
 2#  Copyright(C) 1998
 3#  All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4#
 5#  Permission from use, copy, modify, and distribute this
 6#  software and its documentation for EDUCATIONAL purposes
 7#  and without fee is hereby granted provided that this
 8#  copyright notice appears in all copies.
 9#
10#  date   : January 1, 1998.
11#  author : Salih Yurttas.
12#
13#  aa_01.pl
14#
15
16
17use warnings;
18
19# create array of array
20@aa = ( [0, 1, 2, 4, 8],
21        [1, 3, 5],
22        [0, 2, 4, 8], ); 
23
24for $row (@aa) {
25  print "@$row \n";
26}
27
28print "\n";
29
30for $i (0..$#aa) {
31  print "@{$aa[$i]} \n";
32}
33
34print "\n";
35
36for $i (0..$#aa) {
37  for $j (0..$#{$aa[$i]}) {
38    print "$aa[$i][$j] ";
39  }
40  print "\n";
41}
42
43print "\n";
44
45for $i (0..$#aa) {
46  $t = $aa[$i];
47  for $j (0..$#{$t}) {
48    print "$t->[$j] ";
49  }
50  print "\n";
51}