ameezys has asked for the wisdom of the Perl Monks concerning the following question:
@input_array = N1 N2 N3 N6 N7 @input_A = N1 N3 N11 N11 N10 N16 @input_B = N3 N6 N2 N7 N16 N19
if (grep { @input_B eq $_ } @input_array) { if (grep { @input_A eq $_ } @input_array) { foreach my $inputKey (@input_array) { @{$primaryCC0{$inputKey}} = (1,1); # each key of the hash +has an array with 2 values } foreach my $key (sort keys %primaryCC0) # to display value CC0 + and CC1 { my ($CC0, $CC1) = @{$primaryCC0{$key}}; print "CC0[$key] = $CC0\n"; print "CC1[$key] = $CC1\n\n"; } } else {print "only 1 input is PI";} } else {print "this is a wire\n\n";}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Matching elements inside two arrays
by Athanasius (Archbishop) on Apr 10, 2019 at 06:33 UTC | |
|
Re: Matching elements inside two array
by Marshall (Canon) on Apr 10, 2019 at 05:24 UTC | |
|
Re: Matching elements inside two array
by hdb (Monsignor) on Apr 10, 2019 at 08:01 UTC | |
by hdb (Monsignor) on Apr 10, 2019 at 08:24 UTC | |
|
Re: Matching elements inside two array
by hippo (Archbishop) on Apr 10, 2019 at 07:52 UTC | |
|
Re: Matching elements inside two array
by ameezys (Acolyte) on Apr 10, 2019 at 17:07 UTC | |
by AnomalousMonk (Archbishop) on Apr 10, 2019 at 20:16 UTC | |
by ameezys (Acolyte) on Apr 11, 2019 at 02:12 UTC | |
by Marshall (Canon) on Apr 12, 2019 at 15:03 UTC | |
by Aldebaran (Curate) on Apr 11, 2019 at 20:20 UTC |