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

Functions and subroutines?

Thread Next
September 11, 2018 10:48
Functions and subroutines?
Message ID:
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,

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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About