K
ktom
I have to subs in which i am attempting to pass multiple args to and i
have managed to get it to work, after spending all afternoon trying to
get my brain around it. I still don't have my brain around and the
solution seems absurd!!
below are snippets...
1st call:
&printVec( \@spline, \@indx, \@port1 );
}
1st working sub:
sub printVec {
#our @spline;
# my (@spline,@indx,@port) = @_ ;
# print "pre @$spl, @$indx, @$port\n";
# print "spline @spline\n";
my ($spl,$indx,$port) = @_ ;
my @prt = @$port ;
my @ndx = @$indx ;
my @spline = @$spl ;
2nd call:
&printTset( \@indx, $vect, $cmmnt ) ;
}
2nd working sub:
sub printTset {
my ( $indx, $vct, $cmt) = @_ ;
my @ndx = @$indx;
my $vect = $vct;
my $cmmnt = $cmt;
if i don't use the \ on the passed parameters, it seems to merge them
all into one big array.. blahh.
this seems like a lot of code, seemingly redundant to my wee perl mind,
to pass values to a subroutine.
what magic am i missing or is this just the way it is???
thanks..
have managed to get it to work, after spending all afternoon trying to
get my brain around it. I still don't have my brain around and the
solution seems absurd!!
below are snippets...
1st call:
&printVec( \@spline, \@indx, \@port1 );
}
1st working sub:
sub printVec {
#our @spline;
# my (@spline,@indx,@port) = @_ ;
# print "pre @$spl, @$indx, @$port\n";
# print "spline @spline\n";
my ($spl,$indx,$port) = @_ ;
my @prt = @$port ;
my @ndx = @$indx ;
my @spline = @$spl ;
2nd call:
&printTset( \@indx, $vect, $cmmnt ) ;
}
2nd working sub:
sub printTset {
my ( $indx, $vct, $cmt) = @_ ;
my @ndx = @$indx;
my $vect = $vct;
my $cmmnt = $cmt;
if i don't use the \ on the passed parameters, it seems to merge them
all into one big array.. blahh.
this seems like a lot of code, seemingly redundant to my wee perl mind,
to pass values to a subroutine.
what magic am i missing or is this just the way it is???
thanks..