How can I compare different elements of array in Perl?

后端 未结 2 484
鱼传尺愫
鱼传尺愫 2021-01-07 08:12

I am new to this field. So kindly go easy on me. I have two arrays:

@array1 = (\"ABC321\", \"CDB672\", \"PLE89\",....);

@array2 = (\"PLE89\", \"ABC678\", \"         


        
2条回答
  •  庸人自扰
    2021-01-07 09:00

    Language-agnostic suggestion would be to sort both arrays first (should take you O(n lg(n)), then compare with two iterators in linear time. If performance is not an issue, just keep it simple and go with quadratic number of pair-wise comparisons. While sorting you can also get rid of digits in the end.

提交回复
热议问题