On Oct 4, s wang said: >i have just started writing some scripts in PERL and i am trying to catch >a deadline, i really wish i could get some help for this problem. any >suggestion is greatly appreciated. > >i have a set of files with sequences aligned in the following format. i >wonder how i can eliminate the new line characters within each sequence >without touching those between sequences?
Heh, a much simpler way is: open DNA, "< dna.txt" or die "can't read dna.txt: $!"; open NEW_DNA, "> dna.txt.new" or die "can't write dna.txt.new: $!"; { local $/ = ""; while (<DNA>) { chomp; # get rid of the newlines at the end... tr/\n//d; # get rid of the newlines in the text... print NEW_DNA "$_\n\n"; # and replace the newlines at the end } } close NEW_DNA; close DNA; -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know. ] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]