Hi, Here is a simple program:
>1 my @nums = (1..100); >2 my $result = &total(@nums); >3 >4 print "$result\n"; >5 >6 sub total { >7 my $sum; >8 foreach(@_){ $sum += $_ } >9 $sum; >10 } My question is without line 9, the return value is nothing, while I expect it will return the value of $sum, as it is the last expression being evaluated, is it correct? Thanks in advance. -- Zeng Nan Simple is Beautiful. ~~~~~~~~~~~~~~~~~~~~ PGP Key: http://hobbit.homeunix.org
pgpTSqHV50Dji.pgp
Description: PGP signature