neversaint has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use Data::Dumper; use List::Compare; my @AoA = ( [ 'beethoven', 'berlioz', 'strauss' ], [ 'wagner', 'mozart', 'brahms' ], [ 'sibelius', 'elgar', 'dvorak' ] ); # Should return 1 (True) my $test = [ 'wagner', 'mozart', 'brahms' ]; # Should return 0 (False) my $test2 = [ 'faure', 'debussy', 'stravinksy' ]; print check_if_inst_occur_already(\@AoA,$test),"\n"; print check_if_inst_occur_already(\@AoA,$test2),"\n"; sub check_if_inst_occur_already { my ( $store, $inst_set ) = @_; INST_ALREADY: foreach my $ins_already ( @{$store} ) { my $lc = List::Compare->new( $ins_already, $inst_set ); my $eq = $lc->is_LeqvlntR; print "EQ : $eq\n"; if ( $eq == 0 ) { return 0; } else { return 1; last INST_ALREADY; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Checking if an Array is a Member of an AoA
by jhourcle (Prior) on Dec 23, 2005 at 13:47 UTC | |
|
Re: Checking if an Array is a Member of an AoA
by holli (Abbot) on Dec 23, 2005 at 14:33 UTC | |
by neversaint (Deacon) on Dec 24, 2005 at 02:01 UTC | |
by swampyankee (Parson) on Dec 24, 2005 at 04:13 UTC | |
by holli (Abbot) on Dec 24, 2005 at 14:20 UTC | |
|
Re: Checking if an Array is a Member of an AoA
by educated_foo (Vicar) on Dec 23, 2005 at 14:35 UTC | |
|
Re: Checking if an Array is a Member of an AoA
by myuji (Acolyte) on Dec 23, 2005 at 15:11 UTC | |
|
Re: Checking if an Array is a Member of an AoA
by calin (Deacon) on Dec 23, 2005 at 18:14 UTC |