Perl で、配列中の重複レコードを削除するには?

373
Nice!
配列の中にある重複するレコードを削除する場合、Perl なのでいろいろな方法があると思うが、以下のコードを試してみて欲しい。
#/usr/bin/perl -w

my @array = ('a', 'b', 'c', 'a');

my %count;
@array = grep {!$count{$_}++} @array;

print @array; # 出力は abc となる。

1;
トラックバック URL: http://perltips.twinkle.cc/trackback/83
answer this post
The home loans suppose to be useful for guys, which would like to organize their organization. As a fact, it's not hard to receive a consolidation loan.
Posted by FullerAntoinette (未認証ユーザ) on 2010/07/06(火) 01:48
reply this post
Nobody is able to guarantee that you get good grades. However, you are able to buy coursework and increase your chances.
Posted by ObrienMelisa20 (未認証ユーザ) on 2010/07/10(土) 00:00
answer this post
I think it's absorbing, because it demonstrate a very academic-focussed attitude. Preserving the forthrightness of the academic system seems to be a crash project, although frankly declare illegal remunerated ads for such a service seems a fragile response. When the enterprise is known by your friends who were animated with the results of the alliance, about this post . But don't foreget always to use plagiarism checker run them through this plagiarism detection system for absolute checking and make sure that your material is authentic.
Posted by TishaFry30 (未認証ユーザ) on 2010/08/28(土) 11:00
PHP で、配列中の重複レコードを削除するには?
Trackback from Perl Tips: PHP には配列中の重複するレコードを削除するための、array_unique......
Posted by Perl Tips (未認証ユーザ) on 2006/05/09(火) 06:20
MySQL で、重複レコードを抽出する方法
Trackback from Perl Tips: MySQL (まぁ、単なる SQL)で、データベース中の重複レコードを除いて検......
Posted by Perl Tips (未認証ユーザ) on 2006/05/19(金) 20:08