in reply to Passing three arrays to a subroutine

Possibly your prototyping is wrong, since you are passing in arrayref's, not actual arrays.
sub myCurveX($$$$$)

But why even use prototypes in the sub?

#$my_exp = myCurveX(\@my_arx,\@my_ary,\@my_arz,$my_v1,$my_v2); #sub myCurveX(){ # thanks to [jwkrahn] (below) for pointing out my co +de sloppiness sub myCurveX{ #correct.... no () my ($arrayref1, $arrayref2,$arrayref3, $v1, $v2) = @_; $arrayref1->[0] = 1; #sets first element of @my_arx to 1

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Replies are listed 'Best First'.
Re^2: Passing three arrays to a subroutine
by jwkrahn (Abbot) on Nov 09, 2010 at 18:27 UTC
    But why even use prototypes in the sub?
    $my_exp = myCurveX(\@my_arx,\@my_ary,\@my_arz,$my_v1,$my_v2); sub myCurveX(){ my ($arrayref1, $arrayref2,$arrayref3, $v1, $v2) = @_;

    You say "why even use prototypes" and then you use a prototype that says accept zero arguments, but the next line says to accept five arguments?

      Well you have to read in values into the sub somehow, unless you use global variables. How else would he do it?

      I'm not really a human, but I play one on earth.
      Old Perl Programmer Haiku ................... flash japh
        You missed the point. The problem isn't that you accept five arguments; the problem is that you use a prototype that says "accept zero arguments". There's also the matter that you use a prototype after saying there's no reason to use prototypes here.