try this, @b[0..9] = @a[0..9];
----- 原邮件 ----- 从: itshardtogetone <[email protected]> 日期: 星期四, 一月 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: [email protected] For additional commands, e-mail: [email protected] http://learn.perl.org/
