<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><DIV>Hi folks,</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Can you pass a two-dimensional array to a sub via a reference in Perl 5.8.6?</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I'm operating under use strict.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I have populated a 2D array called @Rain_series, like this...</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>$array[0][0] = n</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>$array[1][0] = m</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>etc</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I checked that it has the right values in the right places by printing off a few of them.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I then compile all the arguments for the subroutine in a further array called @Timestep_arguments, in which the sixth element is a reference to my 2D array ( \@Rain_series ).</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I then passed @Timestep_arguments into a sub via a reference. The sub looks like this...</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>sub Rain_calculation (\@) {...}</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Inside the sub, I define another array like this...</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>my $a<SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>=<SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>@_</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>my @Rain_series = @$a[5]</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Where @Rain_series refers to the values in my 2D array.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>The funny thing is that when I print $Rain_series[0][i] from inside the sub (and after it), I get the right value. When I print $Rain_series[1][i], I get 'undefined'. </DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>It appears that the second 'column' in the array is not getting passed into the sub.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Any help would be appreciated. Thanks in advance.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Lucida Grande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Lucida Grande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Lucida Grande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV>Regards,</DIV><DIV>Martin</DIV><DIV>Visit my website...</DIV><DIV><A href="http://web.mac.com/martin_jacobs1"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 238); -khtml-text-decorations-in-effect: underline; ">http://web.mac.com/martin_jacobs1 </SPAN></A></DIV><BR class="Apple-interchange-newline"></SPAN></SPAN></SPAN> </DIV><BR></BODY></HTML>