- 论坛徽章:
- 0
|
原帖由 andyhau791010 于 2008-8-27 14:10 发表
以下的数组:@read={"0101","0101","0102","0101","0103","0102"}
我如何得到这样的数组:@read={"0101","0102","0103"}
急用,谢谢大家。
Are you sure that your array expression with "{}" instaed of "()" is RIGHT?
@read={"0101","0101","0102","0101","0103","0102"}
That is an array contains reference to hash!!!
For extracting an uniq array, hash and map can be used too:
@read = ("0101", "0101", "0102", "0101", "0103", "0102");
%seen = map {$_, 1} @read;
@uniq = sort keys %seen;
print "@uniq"; |
|