Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Seemingly enigmatic data structures

by Prior Nacre V (Hermit)
on Mar 05, 2005 at 06:34 UTC ( #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? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2022-05-23 11:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (82 votes). Check out past polls.

    Notices?