Arrays 为什么可以';我的Perl程序找不到数组::Utils?

Arrays 为什么可以';我的Perl程序找不到数组::Utils?,arrays,perl,module,cpan,Arrays,Perl,Module,Cpan,使用数组::Utils qw(:all)#它显示错误。无法在grep_exr.pl第5行的@INC(@INC包含:/usr/local/lib64/perl5/usr/local/share/perl5/usr/lib64/perl5/vendor\u perl/usr/perl/lib64/perl5/usr/share/perl5.)中找到Array/Utils.pm。为什么显示此错误。我的代码有什么错误?或任何其他方法,我们必须满足我的要求。请让我们知道。您的答案将不胜感激。正如上面所说,

使用数组::Utils qw(:all)#它显示错误。
无法在grep_exr.pl第5行的@INC(@INC包含:/usr/local/lib64/perl5/usr/local/share/perl5/usr/lib64/perl5/vendor\u perl/usr/perl/lib64/perl5/usr/share/perl5.)中找到Array/Utils.pm。
为什么显示此错误。我的代码有什么错误?或任何其他方法,我们必须满足我的要求。请让我们知道。您的答案将不胜感激。

正如上面所说,它找不到模块。可能是因为您从未安装过它

use Array::Utils qw(:all);# it showing error
my @array1 = (1, 2, 3, 5, 7, 23, 8, 14, 95, 19);
my @array2 = (3, 14, 6, 22, 88, 19, 100);
my@isect = intersect(@array1,@array2);
print @isect,$/;
或者你可以写你自己的解决方案

cpan Array::Utils

就像上面说的,它找不到模块。可能是因为您从未安装过它

use Array::Utils qw(:all);# it showing error
my @array1 = (1, 2, 3, 5, 7, 23, 8, 14, 95, 19);
my @array2 = (3, 14, 6, 22, 88, 19, 100);
my@isect = intersect(@array1,@array2);
print @isect,$/;
或者你可以写你自己的解决方案

cpan Array::Utils

如果不使用模块,该怎么办:

my %array1 = map { $_ => 1 } @array1;
my @intersect = grep { $array1{$_} } @array2;
顺便说一句,如果要安装Array::util,请从以下位置下载tar文件:

以root用户身份执行以下步骤

#!/usr/bin/perl -w                                                                                                                      

my @union = @intersection = @difference = ();
my %count = ();

my @array1 = (1, 2, 3, 5, 7, 23, 8, 14, 95, 19);
my @array2 = (3, 14, 6, 22, 88, 19, 100);

foreach my $element (@array1, @array2) {
  $count{$element}++
 }

foreach my $element (keys %count) {
   push @union, $element;
   push @{ $count{$element} > 1 ? \@intersection : \@difference }, $element;
}

foreach my $k ( keys %count ) {
  if ( $count{$k} > 1 ) {
    print "$k exist on both the arrays\n";
  }
}

如果不使用模块,该怎么办:

my %array1 = map { $_ => 1 } @array1;
my @intersect = grep { $array1{$_} } @array2;
顺便说一句,如果要安装Array::util,请从以下位置下载tar文件:

以root用户身份执行以下步骤

#!/usr/bin/perl -w                                                                                                                      

my @union = @intersection = @difference = ();
my %count = ();

my @array1 = (1, 2, 3, 5, 7, 23, 8, 14, 95, 19);
my @array2 = (3, 14, 6, 22, 88, 19, 100);

foreach my $element (@array1, @array2) {
  $count{$element}++
 }

foreach my $element (keys %count) {
   push @union, $element;
   push @{ $count{$element} > 1 ? \@intersection : \@difference }, $element;
}

foreach my $k ( keys %count ) {
  if ( $count{$k} > 1 ) {
    print "$k exist on both the arrays\n";
  }
}


ikegami,如何安装此模块?我从tel me How to install
[Ram@localhost工作]$cpan Array::Utils bash:cpan:command未找到
您的Perl安装@ikegami已损坏,那么如何正确安装?ikegami,如何安装此模块?我从tel me How to install
[Ram@localhost工作]$cpan Array::Utils bash:cpan:command未找到
您的Perl安装@ikegami已损坏,那么如何正确安装?、如何安装Array::util模块。请告诉我。哇,写
my%array1=map{$\=>1}@array1,这是一个很长的过程;my@intersect=grep$array1{$},@array2谢谢@ikegami。我也知道。@yopy[Ram@localhost工作]$cpan Array::Utils bash:cpan:command not foundperl-MCPAN-e'install Array::Utils'也会进行安装,如何安装Array::util模块。请告诉我。哇,写
my%array1=map{$\u=>1}@array1;my@intersect=grep$array1{$},@array2谢谢@ikegami。我也知道。@yopy[Ram@localhostwork]$cpan Array::Utils bash:cpan:command not foundperl-MCPAN-e'install Array::Utils'也执行安装。