in reply to compare two arrays if both are equal and have same elements irrespective of their position

There are plenty of features in Test2::V0. To compare an array with an unordered list of its values, there are bags. You may do something like:

use Test2::V0; my $have = [qw(c a b)]; is $have, bag {item $_ for qw(a b c); end}, 'matches'; isnt $have, bag {item $_ for qw(a a b c); end}, 'missing dup'; isnt $have, bag {item $_ for qw(a b); end}, 'one to much'; isnt $have, bag {item $_ for qw(a b c d); end}, 'one missing';

Greetings,
-jo

$gryYup$d0ylprbpriprrYpkJl2xyl~rzg??P~5lp2hyl0p$
  • Comment on Re: compare two arrays if both are equal and have same elements irrespective of their position
  • Select or Download Code