Yurttas/PL/SL/perl/F/03/01/03/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 add {
18  $t = 0;
19
20  foreach $_ (@_) {
21    $t += $_;
22  }
23
24  return $t;
25}
26
27my $a = 1;
28my $b = 3;
29my $c = 2;
30my $d = 6;
31
32print "a = $a\n";
33print "b = $b\n";
34print "c = $c\n";
35print "d = $d\n";
36print "\n";
37
38my $t = add($a, $b, $c, $d);
39
40print "t = $t\n";
41print "\n";