In Perl, is there a built in way to compare two arrays for equality?

后端 未结 13 2320
无人及你
无人及你 2020-11-27 17:08

I have two arrays of strings that I would like to compare for equality:

my @array1 = (\"part1\", \"part2\", \"part3\", \"part4\");
my @array2 = (\"part1\", \         


        
13条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-27 17:22

    There's Test::More's is_deeply() function, which will also display exactly where the structures differ, or Test::Deep's eq_deeply(), which doesn't require a test harness (and just returns true or false).

提交回复
热议问题