小编Mar*_*ary的帖子

两个Perl数组的常见元素

可能重复:
使用Perl比较两个数组

我试图找到两个文件中常见的元素:下面是我的代码.请告诉我我在做什么错.

open IN,  "New_CLDB.txt"     or die "couldn't locate input file";
open IN1, "New_adherent.txt" or die "couldn't locate input file";
use Data::Dumper;
@array = ();
while (<IN>) {
    $line = $_;
    chomp $line;
    $a[$i] = $line;
    ++$i;
}
while (<IN1>) {
    $line1 = $_;
    chomp $line1;
    $b[$m] = $line1;
    ++$m;
}
for ( $k = 0; $k < $i; ++$k ) {
    for ( $f = 0; $f < $m; ++$f ) {
        if ( $a[$k] ne $b[$f] ) …
Run Code Online (Sandbox Code Playgroud)

perl

0
推荐指数
1
解决办法
2399
查看次数

标签 统计

perl ×1