in reply to variation on splitting a string into elements of an array
in thread splitting a sequence using unpack
$left_out will contain the number of characters you want to skip from the starting.use strict ; use warnings ; ##updated according to suggestions my $string="atccatccctttaat" ; my $left_out=2 ; my $template = "x$left_out" ; $template .= "a3" x ((length($string)-$left_out)/3) ; my @array=unpack($template, $string) ; local $"="\n" ; print "@array" ;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: variation on splitting a string into elements of an array
by fizbin (Chaplain) on Mar 02, 2005 at 17:07 UTC | |
by manav (Scribe) on Mar 02, 2005 at 17:18 UTC |