[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



    Josh> I have two arrays that are both two dimensional. I assign
    Josh> @foo=[some][multidimensional][array];

Arrays in perl are always one dimensional.  You have an array which
contains references to arrays.</pedant>

If you want to get out a lower level array, you just use @{} to
dereference the apropriate arrayref.

@foo = @{ $bar->[23]->[42] };


Keep in mind that this makes a copy of the contents of the array
referenced by what's in $bar->[23]->[42] and modifying (say) $foo[0]
will not do anything to $bar->[23]->[42]->[0] (to do that you'd want
to instead do: $foo = $bar->[23]->[42]; $foo->[0] += 17).


See perldoc perlreftut, perldoc perllol, and perldoc perldsc.

-- 
Fletch                | "If you find my answers frightening,       __`'/|
fletch at phydeaux.org   |  Vincent, you should cease askin'          \ o.O'
                      |  scary questions." -- Jules                =(___)=
                      |                                               U


</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00248" href="msg00248.html">[ale] Perl question on Arrays</a></strong>
<ul><li><em>From:</em> josh at catea.org (Josh Freeman)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00269.html">[ale] [OT]: Solar Panel Electronics</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00271.html">[ale] USB Keyboard problems</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00255.html">[ale] Perl question on Arrays</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00259.html">[ale] my 3 year old hacker</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00270"><strong>Date</strong></a></li>
<li><a href="threads.html#00270"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>