作者littleshan (布丁珍奶加椰果)
看板perl
标题Re: [问题] get the same elements
时间Tue Mar 25 09:18:46 2003
※ 引述《easy1 ( ~_~ !)》之铭言:
: @a = qw/a b c d e f/;
: @b = qw/a c g h f d b/;
: how can I get the same elements in @a and @b ?
foreach $i (@a){ push @c, grep($i eq $_, @b);}
--
※ 发信站: 批踢踢实业坊(ptt.csie.ntu.edu.tw)
◆ From: 140.112.30.172