Basically I have a text file, each line consists of 8 columns which are tab separated. I am trying to check columns at 4 and 8 and trying to print the whole line. I have done small scripts like this before, may be something wrong today. No idea where I went wrong.
Here comes my code
Expand|Select|Wrap|Line Numbers
- #!usr/bin/perl
- while(<>) {
- chomp $_;
- my(@v) = split(/\t,$_);
- print"Column4: $v[3] \t Column8: $v[7] \n";
- if($v[3] eq 'F' && $v[7] eq 'R') {
- print "$v[3] \t $v[7] \n";
- }
- }
print"Column4:F Column8:R \n";
I am wondering, if the condition is true, why the control of the program does not go inside the if statement and prints print "$v[3] \t $v[7] \n"; statement line. I am really puzzled with the reason not going inside if statement when I know that for sure that this condition is true. Please let me know