in reply to how to splice an array?
Your array code is assuming that @array contains an array where each element is one letter from the string, which is not what it contains. You can make it contain that by using @array = split( '', "PERLPERLPEBLPEBLPERL" ); or you can just understand that you are dealing with a string, not an array, and take a different approach, such as...
my $string = "PERLPERLPEBLPEBLPERL"; my @answer = ( $string =~ m/(.{4})/g ); print "@answer\n";
| We're not surrounded, we're in a target-rich environment! |
|---|
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how to splice an array?
by bobf (Monsignor) on Oct 12, 2006 at 03:38 UTC |