http://www.perlmonks.org?node_id=1079026


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.