Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Why is my result empty?

by Anonymous Monk
on Mar 20, 2014 at 00:20 UTC ( #1079026=note: print w/replies, xml ) Need Help??


in reply to Why is my result empty?

Because my $final_res = $split_final[7]; creates a new variable that is local to the if block, and it hides the other variable named $final_res that you defined before the loop. Write $final_res = $split_final[7]; (remove the my) and you'll only have one variable named $final_res and your code will do what you intend.

In general, you should use warnings; in addition to use strict; to help you catch some potential problems. Also, take a look at Perl::Critic, which can help you catch this kind of error.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1079026]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2018-06-24 00:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (126 votes). Check out past polls.

    Notices?