in reply to how to escape new line in a string
Hello nica,
If you look carefully at this line:
print OUT "Genome: \n $line\n"; # ^^ ^^
you will see that you are adding the newlines yourself! Here is one approach that does what you want:
use strict; use warnings; print 'Genome: '; while (my $line = <DATA>) { $line =~ s/^[0-9]+//; # Remove initial digits $line =~ s/\s+//g; # Remove all whitespace (including newline +s) print $line if $line =~ /[acgt]+/; } print "\n"; __DATA__ INPUT ORIGIN 1 ccctaaaccc taaaccctaa accctaaacc ctaaacccta aaccctaaac cctaaaccct 61 aaaccctaaa ccctaaaccc taaaccctaa accctaaacc ctaaacccta aaccctaaac 121 cctaaaccct aaaccctaaa cgatgcatta ctactcacac gaacgagtga atgaaacaca
Output:
18:35 >perl 2007_SoPW.pl Genome: ccctaaaccctaaaccctaaaccctaaaccctaaaccctaaaccctaaaccctaaaccctaa +accctaaaccctaaaccctaaaccctaaaccctaaaccctaaaccctaaaccctaaaccctaaacccta +aaccctaaacgatgcattactactcacacgaacgagtgaatgaaacaca 18:35 >
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|