in reply to Finding wether all elements of one array are in another

Hi tsk1979, Try this,

use strict; use warnings; use Array::Compare; my @ar1 = qw(-true -depth=1); my @ar2 = qw(-search -depth=1 -true -expand_all); my $comp = Array::Compare->new(); if ($comp->compare(\@ar1, \@ar2)){print "Same Array OK";}else{print " +Different Array OK";}

Updated davorg solution is correct. compare function compare the arrays in order.

Regards,
Velusamy R.


eval"print uc\"\\c$_\""for split'','j)@,/6%@0%2,`e@3!-9v2)/@|6%,53!-9@2~j';

Replies are listed 'Best First'.
Re^2: Finding wether all elements of one array are in another
by davorg (Chancellor) on Mar 31, 2006 at 09:48 UTC

    Looks like order isn't significant, so you might be better off using the perm method rather than the compare method.

    --
    <http://dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg