in reply to How to split an array identified by numbers to get the correct sequence of elements
my $string = "CCATGNNNTAACCNNATGNNTAGCC"; my @substrings; foreach my $offset ([3, 11], [16, 23]) { push @substrings, substr($string, $offset->[0] - 1, $offset->[1] - + $offset->[0] + 1); } my ($substr1, $substr2) = @substrings; print "$substr1\n$substr2\n";
|
|---|