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

Better solution:

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

Better yet:

use List::Util qw( uniq ); my @uniqWebCustomers = uniq @webCustomers;

Replies are listed 'Best First'.
Re^2: Fixing: Experimental keys on scalar is now forbidden
by kennethk (Abbot) on Jun 06, 2018 at 14:42 UTC
    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.

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

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