Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

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

by kennethk (Abbot)
on Jun 06, 2018 at 14:42 UTC ( [id://1216031]=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

I agree with the "Better yet," but in situations where I do something like option 1, I like to wrap it in a do block to maintain tight scoping:
my @uniqWebCustomers = do{ my %seen; grep !$seen{$_}++, @webCustomers; };

#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

Replies are listed 'Best First'.
Re^3: Fixing: Experimental keys on scalar is now forbidden
by ikegami (Patriarch) on Jun 07, 2018 at 01:42 UTC

    If you're going to add a block, make it a sub.

    sub uniq { my %seen; grep !$seen{$_}++, @_ } my @uniqWebCustomers = uniq @webCustomers;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2024-04-24 21:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found