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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.