[EMAIL PROTECTED] wrote:
>
> What about...
>
> $old_pos = 1;
> $new_pos = 1;
>
> while ($old_pos <= @old_array) {
> if ($old_pos < $insert_pos) {
> @new_array[$new_pos - 1] = @old_array[$old_pos - 1];
> $new_pos = $new_pos + 1;
> } else {
> @new_array[$new_pos - 1] = $insert_str;
> $new_pos = $new_pos + 1;
> @new_array[$new_pos - 1] = @old_array[$old_pos - 1];
> $new_pos = $new_pos + 1;
> }
>
> $old_pos = $old_pos + 1;
> }
>
It's right, but not the Perl Way, I believe.
A simple problem like inserting into the middle of arrays should be less
than 15 lines.
Greetings,
Andrea
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]