I am performing a phylogenetic tree from sequence alignments with a software that requires no whitespaces and no brackets/parentheses in the text file. I try to substitute my whitespaces with underscores and my brackets with whitespaces so that the file can be read without problem in the alignment software. My code runs without error warnings, but does not give any output whatsoever.
foreach my $line (<>) { chomp ($line); if ($line =~ m/^>/) { #if line matches ">" at beginnin +g if ($line =~ /\s/g) { #if line matches whitespa +ce globally $line =~ s/\]/\s/; $line =~ s/\[/\s/; $line =~ s/\s /_/g; #substitut +e whitespace with underscore. } } }
In reply to Replacing Whitespace with Underscore by CPTQuesoXI
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |