use v5.16; use List::MoreUtils 'reduce_u'; my @array = qw(alpha beta gamma); reduce_u {say "at position $_ there is $b"} @array;