for (my $i = 0; $i < @arry; $i++) {
    splice (@arry, $i, 1, split (' ', $arry[$i], 2));
}
If one of the elements of @arry contains "one two three" then using "2" will
add the two elements "one" and "two three" instead of the three elements
"one", "two" and "three" so you may still be left with elements containing
whitespace.
Uh huh. And that's just on the /first/ iteration. What about every other iteration? Try it:

$" = ':';
for (my $i = 0; $i < @arry; $i++) {
        print "\$i == $i, [EMAIL PROTECTED] = @arry\n";
        splice (@arry, $i, 1, split (' ', $arry[$i], 2));
}


$i == 0; @arry = one two three
$i == 1; @arry = one:two three
$i == 2; @arry = one:two:three

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to