[prev in list] [next in list] [prev in thread] [next in thread]
List: perl-beginners
Subject: =?gb2312?B?u9i4tA==?=:how to copy elements into the next array
From: yantao () neusoft ! com
Date: 2009-01-29 7:42:03
Message-ID: 4a3c84a274.4a2744a3c8 () neusoft ! com
[Download RAW message or body]
try this,
@b[0..9] = @a[0..9];
----- ÔÓʼþ -----
´Ó: itshardtogetone <itshardtogetone@hotmail.com>
ÈÕÆÚ: ÐÇÆÚËÄ, Ò»Ô 29ÈÕ, 2009 Ï Îç2:39
Ö÷Ìâ: how to copy elements into the next array
> Hi,
> How do I copy the first 10 elements of @a into @b?
>
> The method that I use is long :-
> my @a = 1..20;
> my @b = ();
>
> my $ctr = 0;
> foreach (@a){
> if ($ctr < 10){
> push @b,$_;
> }
> $ctr ++;
> }
>
>
>
>
>
>
> Thanks.
>
>
--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic