Quoting Kåre Edvardsen <[EMAIL PROTECTED]>:

> Hi all.
>
> I can't figure out how to change elements of an array after read in data
> from rcols with the PERLCOLS option.
>
> Here is basically what I'm doing:
>
>> {$x, $y, @arr_I} = rcols "xxx.dat", 0, 1, {PERLCOLS => [2]}
>> {$a, $b, @arr_II} = rcols "yyy.dat", 0, 1, {PERLCOLS => [2]}
>
> Now I'd like to change some elemnts of @arr_I with elements from
> @arr_II.
>
> Something like:
>
> for $i (0..10) {
>
> @arr_I[$i] = @arr_II[$i + 10];
>
> }

Hi Kåre,

The PERCOLS columns are returned as references to arrays, so you'd do:

    ($x, $y, $arr_I) = rcols ....

    Then for $i (0..10) { $arr_I->[$i] = $arr_II->[$i+10]}

should work.

                    Cheers,
                         Jarle.



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to