Yurttas/PL/SL/perl/F/03/01/06/a 02.pl

 1# 
 2#  Copyright(C) 2003
 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, 2003.
11#  authorĀ : Salih Yurttas.
12#
13#  a_02.pl
14#
15
16
17sub f {
18  $t = @_[0];
19
20  $n = @_;
21
22  print "\nsub / t = $t, n = $n\n";
23
24  for($i=1; $i<$n; ++$i) {
25    $a[$i-1] = @_[$i];
26  }
27
28  $n = @a;
29
30  print "\nsub / n = $n\n";
31
32  print "\n";
33
34  foreach $e (@a) {
35    print "$e\n";
36  }
37
38  return @a;
39}
40
41@list = (1,3,4,2);
42
43$k = @list;
44
45print "\n";
46print "main / k = $k\n";
47
48foreach $e (@list) {
49  print "$e\n";
50}
51
52@a = f($k,@list);
53
54print "\n";
55print "main /\n";
56
57foreach $e (@a) {
58  print "$e\n";
59}