in reply to Re: uninitialized values
in thread uninitialized values

Thanks Ken for pointing me out the faults I have committed,I would keep in mind.But then how can, I get those values outside If - block.And another thing is, that those variable names are only for testing purpose ,I just wanted to check that whatever I have been doing there is write or wrong .I will give them a meaningful name once I am done with it

Replies are listed 'Best First'.
Re^3: uninitialized values
by kcott (Archbishop) on Aug 20, 2013 at 06:08 UTC

    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

      I will keep these things in mind.Sorry for it.Thanks