Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^4: hash deref confusion: Intermediate Perl

by tobyink (Canon)
on Jul 30, 2012 at 08:30 UTC ( [id://984388]=note: print w/replies, xml ) Need Help??


in reply to Re^3: hash deref confusion: Intermediate Perl
in thread hash deref confusion: Intermediate Perl

That's not specific to slices though. In Perl 6 sigils are not context-dependent; they are variable-dependent and context-invariant. In Perl 5, where sigils are used to indicate context, using @ for hash slices is pretty consistent with the rest of the language.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Replies are listed 'Best First'.
Re^5: hash deref confusion: Intermediate Perl
by Anonymous Monk on Jul 30, 2012 at 08:37 UTC

    .... using @ for hash slices is pretty consistent with the rest of the language

    It is, but its still quirky, look, there is a list on the right side:

    %hash = @list;

    @list = %hash;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-09-16 02:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The PerlMonks site front end has:





    Results (21 votes). Check out past polls.

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.