"Vineet Pande" <[EMAIL PROTECTED]> writes: > hi, > In the following code which reads a file.txt (SEE ATTACHMENT) where I > am trying to understand how to put the DNA sequence in to a single > string... > > print "enter file with DNA sequence: "; > $seqfile = <STDIN>; > chomp $seqfile; > unless ( open(DNAFILE, $seqfile) ) > { > print "can't open!!\n"; > exit; > } > @dna = <DNAFILE>; > close DNAFILE; > > $dna = join( '', @dna); > print "$dna\n"; > > THE OUTPUT IS EXACTLY THE SAME AS IN file.txt.....Why don't we get the > string joined...of course i agree i must clean whitespace...bu then > what is expected out of join( '', ....). WHAT '' means?
You do actually get what you asked for that way. The filecontent as one single string. But if I try to get what you actually want, it's probably the filecontent whitout the newlines. To get that you simply have to remove them. Put a chomp(@dna) before the join. -- Christer -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>