but if I want to get it through the reference I have to do
That should be:
but if I want to use the array that $array refrences I have to do
Sorry, I changed the example slightly and didnt change that line.
Anyway, the point to keep in mind that
$_=[]; # $_ now is a refrence to empty array (anonymous array)
$_[0]=[]; # the zeroth element of the array @_
$_->[0]=[];# the zeroth element of the anonymous array
$_{0}=[]; # the value associated with 0 in %_
$_{0}->[0]; # element zero in ^^^^^^^^
$_[0]->[0]; #zeroth element in array refrenced by the zeroth elemtn
+ of @_
$_->[0][0]={}; #dont need a second ->
$_->{0}[0]={}; #this works too
$_->[0]->[0]->{0}="but we can use -> if we want";
$_->{0}[0]{0}="This is getting confusing";
I dont think %_ is used that much, but I could be wrong.
Yves
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|