Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi, I am trying to use strict perl coding for this simple task, but my variable returns empty. Why?
If I print inside the loop, in the comment, it prints fine. what am I missing?
use strict; my $final_res=''; open FILE, $infile; while(my $final_line=<FILE>) { if($final_line=~/^SeqID/) { my $final_line=<FILE>; chomp $final_line; my @split_final=split(/\t/, $final_line); my $final_res = $split_final[7]; $final_res=~s/D/M/g; $final_res=~s/U/M/g; #print $final_res."\n"; } } close FILE; print $final_res."\n";
If I print inside the loop, in the comment, it prints fine. what am I missing?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Why is my result empty?
by toolic (Bishop) on Mar 20, 2014 at 00:14 UTC | |
by Anonymous Monk on Mar 20, 2014 at 00:16 UTC | |
Re: Why is my result empty?
by Anonymous Monk on Mar 20, 2014 at 00:18 UTC | |
Re: Why is my result empty?
by Anonymous Monk on Mar 20, 2014 at 00:20 UTC | |
Re: Why is my result empty?
by Marshall (Canon) on Mar 20, 2014 at 05:49 UTC | |
Re: OT: Why is my result empty?
by AnomalousMonk (Archbishop) on Mar 20, 2014 at 16:27 UTC |
Back to
Seekers of Perl Wisdom