agustina_s has asked for the wisdom of the Perl Monks concerning the following question:
I give this file as an input when I compile it such as:AB Naja atra (Chinese cobra). OC Eukaryota; Metazoa; Chordata; Craniata; Vertebrata; Euteleostomi; OC Lepidosauria; Squamata; Scleroglossa; Serpentes; Colubroidea; OC Elapidae; Elapinae; Naja. OX NCBI_TaxID=8656; // DR Pfam; PF00087; toxin; 1. DR PRINTS; PR00282; CYTOTOXIN. DR ProDom; PD000206; Snake_toxin; 1. DR PROSITE; PS00272; SNAKE_TOXIN; 1. KW Venom; Cytotoxin; Cardiotoxin; Multigene family; 3D-structure; Si +gnal. FT SIGNAL 1 21 FT CHAIN 22 81 CYTOTOXIN 2. FT DISULFID 24 42 //
and I want to go to each record in the file and do something there.. But my code below.. they loop more than expected. For eq if I have 28 records separated my "\/\/\n" then they will loop until 70 times or more. This is my code:perl myprog.pl a.db
Last time I also try this which is also doesn't work well:$/ = "\/\/\n"; $counter=1; while (<>){ # Read the entry print "Entry $counter\n"; print "I don't know what to do \n"; #do something $counter++ }
So what do I have to do? Thanks in advanced.my $infile =$ARGV[0]; open(IN, $infile) or die "Can't open input file: $!"; $/ = "\/\/\n"; $counter=1; while (<IN>){ # Read the entry print "Entry $counter\n"; print "Hallo to you....\n"; # do something $counter++ }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: hm strange loop for me..
by pjf (Curate) on Jan 24, 2002 at 09:30 UTC | |
by agustina_s (Sexton) on Jan 24, 2002 at 10:52 UTC | |
by pjf (Curate) on Jan 24, 2002 at 11:01 UTC | |
by agustina_s (Sexton) on Jan 24, 2002 at 12:21 UTC | |
|
Re: hm strange loop for me..
by jarich (Curate) on Jan 24, 2002 at 09:42 UTC | |
|
Re: hm strange loop for me..
by kschwab (Vicar) on Jan 24, 2002 at 09:31 UTC |