Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: meaning of '@' sigil on a hash?

by ikegami (Patriarch)
on Dec 08, 2007 at 19:19 UTC ( [id://655867]=note: print w/replies, xml ) Need Help??


in reply to meaning of '@' sigil on a hash?

In Perl5, the sigil represents how the variable should be treated. It does not represent the type of the variable. So just like $ can be used by scalar, arrays and hashes, @ can be used by arrays and hashes.

select elementselect elements (slice)all keysall valuesall keys & values
scalar$scalar
array$array[$i]@array[@i](0..$#array)@array
hash$hash{$i}@hash{@i}keys(%hash)values(%hash)%hash
list(...)[@i]

This is all documented in perldata, including slices.

Update: Reordered the columns.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2024-04-19 15:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found