in reply to Variable scope

The behaviour of your code is undefined. You're not allowed to use a lexical variable without first executing its declaration.

Replies are listed 'Best First'.
Re^2: Variable scope
by Anonymous Monk on Apr 03, 2018 at 15:54 UTC
    my @array; should occur within the do loop before either statement occurs, neither of which should use my.