Hii everybody..I have posted a similar question before..but it is slightly changed and I am not finding how to solve it..Please help..
I have a text file with some compound names..now I want a perl program which will scan the whole text file and then if for any entry, C>10 and p<5 found, it'd copy that entry to a new text file.
I have uploaded a sample input text file also.
Thanks in advance...
ghosh22
0
Junior Poster in Training
Recommended Answers
Jump to Postuse strict; use warnings; open(FILE,"<example1.txt"); open(OUT,">example2.txt"); my $x=0; while(<FILE>){ chomp; $x++; if($x==1){ print OUT "$_\n"; next; } my ($Compound,$H,$C,$N,$O,$P,$S,$Cl,$Co,$Se,$Class)=split(/\t/); if($C>10 && $P<5){ print OUT "$_\n"; } } close FILE; close OUT;
All 3 Replies
mitchems
12
Posting Whiz in Training
ghosh22
0
Junior Poster in Training
richieking
44
Master Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.