Re: copy array

2008-03-25 Thread John W. Krahn
[EMAIL PROTECTED] wrote: On Mar 25, 8:50 am, [EMAIL PROTECTED] (Sharan Basappa) wrote: Is there a way I can copy only part of an array into another array. For example, I want to copy only first 8 elements of source array into destination array. You can use the splice( ). See example: #!/usr

Re: copy array

2008-03-25 Thread Chas. Owens
On Tue, Mar 25, 2008 at 12:14 PM, LesleyB <[EMAIL PROTECTED]> wrote: snip > BTW I use a Debian system and use perldoc quite a lot. To check the > syntax for this problem I did > 'perldoc perlintro' and then searched for the word array. The > solution to your problem is there. Not sure how yo

Re: copy array

2008-03-25 Thread LesleyB
Sharan Basappa wrote: > Hi, > > Is there a way I can copy only part of an array into another array. > For example, I want to copy only first 8 elements of source array > into destination array. > > Regards I think you might need this technique #!/usr/bin/perl -w use strict; # my @arr1 =

Re: copy array

2008-03-25 Thread Keenlearner
On 25 Mar, 23:50, [EMAIL PROTECTED] (Sharan Basappa) wrote: > Hi, > > Is there a way I can copy only part of an array into another array. > For example, I want to copy only first 8 elements of source array > into destination array. > > Regards Sure there is, @rainbow = ("red", "green", "blue", "y

Re: copy array

2008-03-25 Thread [EMAIL PROTECTED]
On Mar 25, 8:50 am, [EMAIL PROTECTED] (Sharan Basappa) wrote: > Hi, > > Is there a way I can copy only part of an array into another array. > For example, I want to copy only first 8 elements of source array > into destination array. > > Regards Hi, You can use the splice( ). See example: #!/us

Re: copy array

2008-03-25 Thread Rob Dixon
Sharan Basappa wrote: On Tue, Mar 25, 2008 at 9:31 PM, Rob Dixon <[EMAIL PROTECTED]> wrote: >> Sharan Basappa wrote: > Hi, > > Is there a way I can copy only part of an array into another array. > For example, I want to copy only first 8 elements of source array > into destination array.

Re: copy array

2008-03-25 Thread Sharan Basappa
thanks. I can also assume that variables work instead of 0..7 ($1..$2) so that I can write this as an general algo On Tue, Mar 25, 2008 at 9:31 PM, Rob Dixon <[EMAIL PROTECTED]> wrote: > > Sharan Basappa wrote: > > Hi, > > > > Is there a way I can copy only part of an array into another array.

Re: copy array

2008-03-25 Thread Rob Dixon
Sharan Basappa wrote: Hi, Is there a way I can copy only part of an array into another array. For example, I want to copy only first 8 elements of source array into destination array. my @dest = @source[0..7]; Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: