Others have already advised you to use the strict and warnings pragmata. Do yourself a big favor and heed this sage advice. (If you're a beginning Perler, the diagnostics module is a good adjunct to warnings.) Here's why:
>perl -le "my @mra = ( [ qw(a b eye c) ], [ qw{w x y z} ], ); ;; print qq{'$mra[1][2]'}; print qq{'$mra[i][2]'}; " 'y' 'eye' >perl -le "use warnings; ;; my @mra = ( [ qw(a b eye c) ], [ qw{w x y z} ], ); ;; print qq{'$mra[1][2]'}; print qq{'$mra[i][2]'}; " Unquoted string "i" may clash with future reserved word at -e line 1. 'y' Argument "i" isn't numeric in array element at -e line 1. 'eye' >perl -le "use warnings; use strict; ;; my @mra = ( [ qw(a b eye c) ], [ qw{w x y z} ], ); ;; print qq{'$mra[1][2]'}; print qq{'$mra[i][2]'}; " Bareword "i" not allowed while "strict subs" in use at -e line 1. Execution of -e aborted due to compilation errors.
In the presence of strictures, this particular mistake does not even compile. This, IMHO, is the best possible fate for this code. It's nice to have a warning, but a warning is only generated if the code is executed, and the particular code producing a warning may only be traversed on a daily/weekly/monthly basis. You may find yourself plowing through an enormous log file in search of some clue to a transient problem. Some even take the extra step of escalating all warnings to fatality, so at least a warning will be the last entry in a log file concerning a particular program. Caveat programmor.
In reply to Re: Multiarray does not read correct value from a table
by AnomalousMonk
in thread Multiarray does not read correct value from a table
by korak
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |