in reply to each on reference is experimental at

Hello natxo,

Corion’s solution is preferable, but this does what you want:

#! perl use strict; use warnings; my $HoA = { vowels => [ 'a', 'e', 'i', 'o', 'u', ], primes => [ 2, 3, 5, 7, 11, ], }; { no warnings 'experimental'; while (my ($key, $value) = each $HoA) { print $key . " "; for (@$value) { print "$_ "; } } }

Output:

22:59 > perl 1386_SoPW.pl vowels a e i o u primes 2 3 5 7 11 22:59 >

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Replies are listed 'Best First'.
Re^2: each on reference is experimental at
by ikegami (Patriarch) on Sep 28, 2015 at 16:45 UTC

    I think this particular feature is likely to be removedThis particular feature has been removed from newer versions of Perl, so it's definitely not the best solution.

    Also, there's no reason to disable all experimental warnings when you can just disable the one in question.

    no warnings qw( experimental::autoderef ); # 5.18+
    or
    no if $] >= 5.018, warnings => "experimental::autoderef"; # 5.14+