# note that having a sub for this is overkill, but if you # need more functionality, it's easy to encapsulate here (such # as making it case-insensitive to independant of order) sub stringify { local $" = ""; return "@{$_[0]}" } if (stringify([sort @array1]) eq stringify([sort @array2])) { # arrays are the same } #### my %matches; while (my ($key,$value) = each %somehash) { # stringified arrays as keys push @{$matches{stringify([sort @$value])}} => $key; }