Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Seemingly enigmatic data structures

by Prior Nacre V (Hermit)
on Mar 05, 2005 at 06:34 UTC ( [id://436864]=note: print w/replies, xml ) Need Help??


in reply to Seemingly enigmatic data structures

Linda,

In this context using arrays and hashes, the -> operator:

  • must be used in one place
  • must not be used in one place
  • may be used everywhere else
must

It must be used to access the first data structure level of a reference to an array:

my $ra_staff = \@staff; $ra_staff->[0]...
must not

It must not be used to access the first data structure level of an array:

$staff[0]...
may

It is optional everywhere else: as shown by lidden above.

Regards,

PN5

Replies are listed 'Best First'.
Re^2: Seemingly enigmatic data structures
by tphyahoo (Vicar) on Mar 05, 2005 at 12:16 UTC
    • must be used in one place
    • must not be used in one place
    isn't this a contradiction?

    UPDATE: Ah, OK, I get it now, more or less. Though I do think that could have been more clearly worded.

    "...first data structure level of a reference" is pretty gibberishy to me. But the examples make it more or less clear.

        Thinking "between" helps. But wouldn't that just be brackets and braces? Where are arrows optional between parens?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://436864]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2024-03-19 06:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found