in reply to Re: variation on splitting a string into elements of an array
in thread splitting a sequence using unpack
my $line = 'atccatccctttaat'; my %triplets; for (0 .. 2) { @{$triplets{$_}} = unpack(('x' x $_).'(a3)*',$line); pop @{$triplets{$_}} if length($triplets{$_}->[-1]) != 3; print "Offset $_: @{$triplets{$_}}\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: variation on splitting a string into elements of an array
by fizbin (Chaplain) on Mar 02, 2005 at 18:11 UTC |