close
#!/usr/bin/perl
@array1=(1..12);
@array2=qw(2 4 6 8 10 12);
foreach $tmp(@array1){
if (!grep(/\b$tmp\b/,@array2)){
push @array3,"$tmp\n";
}
}
print @array3;
----------執行結果---------------
1
3
5
7
9
11
@array1=(1..12);
@array2=qw(2 4 6 8 10 12);
foreach $tmp(@array1){
if (!grep(/\b$tmp\b/,@array2)){
push @array3,"$tmp\n";
}
}
print @array3;
----------執行結果---------------
1
3
5
7
9
11
全站熱搜
留言列表