WouterVG: Further to thanos1983's reply: The reason thanos1983's use of the '(a3)*' unpacking template in the Update unpack example given there is much better than the template generated | dynamically generated and used in the OPed
@trips = unpack("a3" x (length($sequence)-2), $sequence);
statement is that the latter produces many (possibly very many) spurious fields:
(Note that Data::Dumper is a core module.)c:\@Work\Perl\monks>perl -wMstrict -le "use Data::Dumper; ;; my $sequence = 'ABCDEFG'; print qq{sequence entered: '$sequence'}; warn sprintf 'sequence length (%d) not multiple of 3', length($sequen +ce) if length($sequence) % 3; ;; my @trips = unpack('a3' x (length($sequence)-2), $sequence); print Dumper \@trips; ;; @trips = unpack('(a3)*', $sequence); print Dumper \@trips; " sequence entered: 'ABCDEFG' sequence length (7) not multiple of 3 at -e line 1. $VAR1 = [ 'ABC', 'DEF', 'G', '', '' ]; $VAR1 = [ 'ABC', 'DEF', 'G' ];
Give a man a fish: <%-{-{-{-<
In reply to Re: Shuffling CODONS
by AnomalousMonk
in thread Shuffling CODONS
by WouterVG
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |