The warning you are getting is about $val. It's telling you that variable is uninitialised on line 69 in some concatenation or string operation.

The warning has nothing to do with either of the print statements you show. I suspect you're already being tripped up by your poorly named variables! The first print statement has $values1[1], that's the second element (index 1) of the @values1 array; the other print statement has $val1[0], that's the first element (index 0) of the @val1 array. Except for the declaration of $val (i.e. my (..., $val) = 0;), that variable appears nowhere in the code you have posted.

Please read "How do I post a question effectively?" then, following its guidelines, produce a minimal script that reproduces your problem. In creating a minimal script, you may well get some insights into whatever your problem is and be able to solve it yourself; if not, then post the minimal script that reproduces your problem and we can look at it further.

"I will give them a meaningful name once I am done with it"

Hopefully, it's now obvious to you that that's the wrong way to do it. Furthermore, consider honestly whether — once your code is written, tested and functioning correctly — you would actually go back and rewrite it. [That's something for you to consider privately to yourself: it's not a question I want an answer to here.]

Give them meaningful names at the outset: write your code well once, then spend the remaining time on something more interesting than rewiting your code a second time. You're making a rod for your back if you do otherwise.

-- Ken


In reply to Re^3: uninitialized values by kcott
in thread uninitialized values by gaurav

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.