This method should be a bit more efficient that either substr in a loop or using the regex engine.
#! perl -slw use strict; my $dna = 'accatgagctgtacgtagcatctgagcgcgcatgactgtgactgacgtaggcagca'; my $n = int( ( length( $dna ) - ( 10 - 3 ) ) / 3 ); print for unpack "(A10 X7)$n", $dna; __END__ C:\Perl\test>test accatgagct atgagctgta agctgtacgt tgtacgtagc acgtagcatc tagcatctga catctgagcg ctgagcgcgc agcgcgcatg gcgcatgact catgactgtg gactgtgact tgtgactgac gactgacgta tgacgtaggc cgtaggcagc
In reply to Re: substr help
by BrowserUk
in thread substr help
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |