You are not really using references to pass arrays (or did you really mean single array elements?) into the subs. You first create a reference (i.e. $ref) but then you dereference it (i.e. @{$ref}) before giving it to the add or multiply sub.
What was probably meant was to pass just $ref into the sub and then dereference it there.
In reply to Re: references to subroutines
by jethro
in thread references to subroutines
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |