yueli711 has asked for the wisdom of the Perl Monks concerning the following question:
Hello, I just want to print a line which contains "Homo sapiens". Thanks in advance!
open(IN1,"tmp01.txt") || die "Cannot open this file"; @lines1 = <IN1>; open(OUT,">tmp03") || die "Cannot open this file"; for $item1(@lines1){ chomp $item1; @tmp1=split(/\t+/, $item1); if ($tmp1[4] eq "Homo sapiens"){ print OUT @lines1; last } print OUT "\n"; } close(IN1); close(OUT);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: print problem
by 1nickt (Canon) on Jun 15, 2018 at 23:17 UTC | |
by yueli711 (Sexton) on Jun 15, 2018 at 23:58 UTC | |
|
Re: print problem
by Paladin (Vicar) on Jun 15, 2018 at 23:20 UTC | |
by yueli711 (Sexton) on Jun 15, 2018 at 23:59 UTC | |
|
Re: print problem
by yueli711 (Sexton) on Jun 15, 2018 at 23:11 UTC |