[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
- <!--x-content-type: text/plain -->
- <!--x-date: Sat Jun 12 19:27:06 2004 -->
- <!--x-from-r13: syrgpu ng culqrnhk.bet (Tyrgpu) -->
- <!--x-message-id: [email protected] -->
- <!--x-reference: 1086979923.15781.75.camel@reddwarf --> "http://www.w3.org/TR/html4/loose.dtd">
- <!--x-subject: [ale] Perl question on Arrays -->
- <li><em>date</em>: Sat Jun 12 19:27:06 2004</li>
- <li><em>from</em>: fletch at phydeaux.org (Fletch)</li>
- <li><em>in-reply-to</em>: <1086979923.15781.75.camel@reddwarf> (Josh Freeman's message of "Fri, 11 Jun 2004 14:52:03 -0400")</li>
- <li><em>references</em>: <1086979923.15781.75.camel@reddwarf></li>
- <li><em>subject</em>: [ale] Perl question on Arrays</li>
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>