The arrow operator is optional everywhere except the first dereference.

ie. $array[0][1] is the same as $array[0]->[1].
In both cases, you have an array (@array) in which the first element ($array[0]) is a reference to another array.

$array[0] is not the same as $array->[0] however.
In the first case, you are accessing the first element of @array. In the second, you are accessing the first element of the array that is referenced by $array (note: $array is a scalar holding a reference to an array).

As for your question about:
$$player_dbref{player_name}{ip_addr} for the player's IP and $$player_dbref{player_name}{ip_addr}{id} to get the user id.

You can't do that, because $$player_dbref{player_name}{ip_addr} cannot hold both the value of the players IP, and a reference to another hash.
What you may want is:
$$player_dbref{player_name}{ip_addr} = "1.2.3.4"; $$player_dbref{player_name}{id} = 007;
In this case you have a reference ($player_dbref) to a hash of player names, the values of which, are another hash which holds IP, id, etc.

In reply to Re: Lamens terms how-to on HoH refs and the arrow operator by Paladin
in thread Layman's terms how-to on HoH refs and the arrow operator by snafu

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.