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# tg_00.pl
14#
15
16
17sub totals {
18 my($sum) = 0;
19 foreach $item (@_) {
20 $sum += $item;
21 }
22 $sum;
23}
24
25@data = (1,2,3,4);
26@vals = (10,20,30,40);
27
28print "sum of @data is ", totals(@data), "\n";
29
30print "sum of @vals is ", totals(@vals), "\n";
31
32print "sum of @vals and @data is ";
33
34print totals(@vals, @data), "\n";