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;