Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

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

by ikegami (Pope)
on Dec 08, 2007 at 19:19 UTC ( #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.


Comment on Re: meaning of '@' sigil on a hash?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (9)
As of 2014-12-25 10:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (160 votes), past polls