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

Re^2: Fixing: Experimental keys on scalar is now forbidden

by ikegami (Patriarch)
on Jun 06, 2018 at 07:25 UTC ( [id://1215998]=note: print w/replies, xml ) Need Help??


in reply to Re: Fixing: Experimental keys on scalar is now forbidden
in thread Fixing: Experimental keys on scalar is now forbidden

it seems to be a question of why the extra braces are required.

The outer %{ ... } is a hash dereference.

The inner { ... } creates a hash and returns a reference to it.

In your first snippet, you have a hash dereference, but no hash.

Replies are listed 'Best First'.
Re^3: Fixing: Experimental keys on scalar is now forbidden
by NetWallah (Canon) on Jun 06, 2018 at 16:55 UTC
    Thanks for the clarification, ikegami (++).

    The postfix syntax below also works, and is easier to read.

    my @t = keys {map { $_ => 1 } qw|uno dos tres| }->%*;

                    Memory fault   --   brain fried

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-24 02:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found