I think the OP is probably ok here.
He is using arrays in a "non-Perl" way and with explicit indices starting at 1 instead of 0. Not using
array[0] is allowed.
$kpi[0] is probably undef.
"Off by one" is one of the most common errors in programming. I personally would rewrite the code so that it doesn't use indices at all like: foreach my $element (@array){} However a re-write like appears to be outside the scope of the question before us. Perl code like that would use index 0.
However there would not be any direct reference to that zero index within the code at all. Creating the kpi array would use "push" instead of explicit indices from 1..n. If the OP creates the kpi array with starting with $kpi[1] that just makes index 0 undef (skips it). I don't see any indication that the OP is aware of: push,pop,shift,unshift.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.