develooper Front page | perl.perl6.users | Postings from September 2018

Functions and subroutines?

Thread Next
From:
ToddAndMargo
Date:
September 11, 2018 10:48
Subject:
Functions and subroutines?
Message ID:
edd1c88e-df8b-2d13-8076-e20d22087899@zoho.com
Hi All,

I use subs like ducks use water.  It is about time
I learned what to properly call them.

I come from Modula2 and Pascal (as well as bash), "functions"
return a value outside the declared parameters and "(sub)routines"
only can modify values through the declarations parameters.

Sort of like
     function:   sub add($a, $b){return $a+$b}
     routine:    sub add($a, $b, rw $c){$c = $a+$b}

In Perl, what is the proper terminology?

Many thanks,
-T

I no longer use "rw $c".  I always use "return".
The guys told me this was the best way on the
chat line, so I adopted it.

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About