in reply to Read/Create files

i is not numeric.

$i is.

Welcome to Perl. :-)

Replies are listed 'Best First'.
Re^2: Read/Create files
by toolic (Bishop) on Mar 20, 2015 at 20:43 UTC
    Luckily, the OP used the strictures, and it resulted in compile errors. Without them, some code will compile and silently do the wrong thing:
    perl -E'@n=7..9;$x=$n[i];say$x' 7

    In this case, i is kinda evaluated as numeric :)

    perl -MO=Deparse -E'@n=7..9;$x=$n[i];say$x' @n = 7..9; $x = $n[0]; say $x; -e syntax OK