Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^3: uninitialized values

by farang (Chaplain)
on Aug 20, 2013 at 04:21 UTC ( #1050120=note: print w/replies, xml ) Need Help??


in reply to Re^2: uninitialized values
in thread uninitialized values

Here's a way to get rid of the warnings, but really you need to reconsider the whole approach used in the while loop. That code is a mess.

By declaring lexical variables inside the loop, they get reset each time through. Move the declarations out of the loop for them to persist.

my (@values1,@val1,@values2,@val2); while (<CMD>) { ...
You will still get one warning from line 1, because the code after the if loop is executed for all lines and @val2 is not yet defined. Adding next can fix that.
my (@values1,@val1,@values2,@val2); while (<CMD>) { if ( $_ =~ /PING/ ){ @values1 = split ; @val1 = split(/\(/,$values1[3]); $val1[1] =~ s/\)//; next; } ...

Again, while these changes avoid the warnings and hopefully show you why they happened, the entire while loop needs a rethink.

Replies are listed 'Best First'.
Re^4: uninitialized values
by gaurav (Acolyte) on Aug 20, 2013 at 05:26 UTC

    yes thanks for it,I got it.I am feeling dumb.Hope I won't committed this mistake again

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1050120]
help
Chatterbox?
[Corion]: thezip: Yeah - we have "CAP", but that means "Change Ablauf Plan" (Change Sequence Plan). Likely there is a true ITIL name for this too.
[Corion]: While I'm not really a fan of ITIL, it certainly is better than nothing and it at least provides a common vocabulary, so if you have ITIL somewhere at your disposal, it might be worth a look
[Corion]: Hmm - that should be somewhere in the "Release Deployment Plan", but I don't find a good English link (nor a good German one ;) )

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (10)
As of 2017-02-23 17:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (350 votes). Check out past polls.