in reply to Re: hm strange loop for me..
in thread hm strange loop for me..

Hi... thanks for the answer.. Actually the problem is the are a few blank lines at the end of the input file.. So after the last // there are a few blank lines which is impossible to be deleted for every case. eg:
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 // RA Jeyaseelan K., Armugam A., Lachumanan R., Tan C.H., Tan N.H.; RT "Six isoforms of cardiotoxin in malayan spitting cobra (Naja naja RT sputatrix) venom: cloning and characterization of cDNAs."; RL Biochim. Biophys. Acta 1380:209-222(1998). RN [6] RP SEQUENCE FROM N.A. RC SPECIES=N.n.kaouthia; TISSUE=Venom gland; RA Li K.J., Wei J.F., Jin Y., Lu Q.M., Xiong Y.L., Wang W.Y.; RT "Molecular cloning and sequence analysis of cDNA of cytotoxin ana +log RT of Naja kaouthia."; // ##there are a few blank lines here
When I eliminated the blank line... things goes just as expected. Is there something to handle this kind of situation? Thanks a lot..

Replies are listed 'Best First'.
Re: Re: Re: hm strange loop for me..
by pjf (Curate) on Jan 24, 2002 at 11:01 UTC
    It's easy enough to check for a blank record:

    $/ = "\n//\n"; # Or whatever is appropriate. while (<>) { chomp; # Removes the field separator. next if /^\s*$/; # Skip "space-only" records. # Do stuff here. }

    This means if there's a blank record at the end (or in the middle, for that matter) it will get skipped instead of processed.

    Cheers,

    Paul Fenwick
    Perl Training Australia

      Thanks... it works..