in reply to Passing three arrays to a subroutine
Try something more like this:
#!/usr/bin/perl use strict; use warnings; my @arx; my @ary; my @arz; my $v1; my $v2; my $exp = myCurve( \@arx, \@ary, \@arz, $v1, $v2 ); sub myCurve { my ( $xar, $yar, $zar, $x, $y ) = @_; my $calc; my @local_x = @$xar; my @local_y = @$yar; my @local_z = @$zar; # do some stuff return $calc; }
Also, if the arrays are large you might want to drop the my @local_x = @$xar lines and operate using the array references.
Note that even though subroutines can be pre-declared with prototypes, this isn't widely used in Perl. See Gratuitous use of Perl Prototypes.
|
|---|