my $line = 'atccatccctttaat'; my @triplets = unpack( "a3" x int( length($line) / 3 ), $line ); my @triplets2 = unpack( 'x' . "a3" x int( ( length($line) - 1 ) / 3 ), + $line ); my @triplets3 = unpack( 'xx' . "a3" x int( ( length($line) - 2 ) / 3 ) +, $line );
In reply to Re: variation on splitting a string into elements of an array
by borisz
in thread splitting a sequence using unpack
by Rashmun
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |