We don't bite newbies here... much | |
PerlMonks |
Re: Re: Nearest Neighbour Analysis subroutineby Elias (Pilgrim) |
on Jan 15, 2001 at 22:02 UTC ( [id://51979]=note: print w/replies, xml ) | Need Help?? |
I thought I had understood your comment, but there is still something I can't figure out. Why does:
Work fine, while the two versions below result in "uneven" in the first case and "even" in the second, when both should be reported as "even".
The BlueCamel says "Any arguments passed to a Perl routine come in as the array @_" (pg 219), and this is clearly what you assume happens when you assign my @mat = @_ in the second line. When I include something like print "@_" to the second line in the sub testhearray (1 and 2), it shows up as an undefined array (or rather, ARRAY(0x9b25fd8) in the first, and nothing in the second). I also find it strange that it is the first of the two subs that apparently requires a reference to @test instead of @_, when this is the one which includes a reference to the array when calling the subroutine. What am I overlooking? (this humbled novice asks).
In Section
Cool Uses for Perl
|
|