Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I don't see the issue here, sorry.

$lines[0] = [3,2,1]: here we agree that [3,2,1] must mean an array reference.

$lines[0][3,2,1]: I fail to see how this can parse as something like ``$lines[ARRAY(0x1a7efd8)]'' (i.e. [3,2,1] becomes an array reference, which is "numericalised" into the value 0x1a7efd8. For that, you'd need an extra set of square brackets: the inner pair delimits an array reference, the outer pair delimits an array index! Indeed, testing $lines[0][[3,2,1]] shows that it behaves as a numericalised array reference.

I can see nowhere in the "grammar" of Perl (I use the term loosely...) where both a scalar value (such as an array reference!) and an array subscript are legal. So there's no problem here.


In reply to Re: Re: Re: Sometimes it's in Void Context by ariels
in thread Sometimes it's in Void Context by Ovid

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



  • 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.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-04-25 08:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found