Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2018-10-21 08:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...














    Results (119 votes). Check out past polls.

    Notices?