# 初期設定(自分の環境に合わせて設定) my $sourcedir = "C:/どっかのディレクトリ"; #リストのあるディレクトリ my $outfile = "C:/tbc.txt"; #結果の出力ファイル
# main(以下、いじる必要なし) my $address = {}; chdir $sourcedir; find(\&check_file, $sourcedir); sub check_file{ open (IN, $_); my @line; while (<IN>){ /\,([a-zA-Z0-9\-\_\. ]+@[a-zA-Z0-9\-\_\. ]+)\,/; if ($1) { print "$1\n" unless($address->{$1}); $address->{$1} = 1; } } close (IN); } my @address = keys(%$address); open (OUT, ">>$outfile"); print OUT join("\n", @address); close (OUT); print "\n\n *** ", $#address + 1, " mail addresses are detected.\n";