Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Is any of Athananius' source helpful? Does it capture any of the logic you seek?

$ ./1.amee.pl N1: only 1 input is PI N2: this is a wire N6: this is a wire N7: this is a wire CC0[N3] = 1 CC1[N3] = 1 $ cat 1.amee.pl #!/usr/bin/perl use 5.016; use strict; use warnings; use List::Util qw( any ); my @input_array = qw( N1 N2 N3 N6 N7 ); my @input_A = qw( N1 N3 N11 N11 N10 N16 ); my @input_B = qw( N3 N6 N2 N7 N16 N19 ); my %primaryCC0; for my $inputKey (@input_array) { if (any { $_ eq $inputKey } @input_A) { if (any { $_ eq $inputKey } @input_B) { @{ $primaryCC0{$inputKey} } = (1, 1); } else { print "$inputKey: only 1 input is PI\n"; } } else { print "$inputKey: this is a wire\n"; } } for my $key (sort keys %primaryCC0) { my ($CC0, $CC1) = @{ $primaryCC0{$key} }; print "CC0[$key] = $CC0\n"; print "CC1[$key] = $CC1\n"; } __END__ $

What I find confusing about this script is non-descriptive output. For example, there is nothing in this problem that has anything to do with PI.


In reply to Re^4: Matching elements inside two array by Aldebaran
in thread Matching elements inside two array by ameezys

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2024-03-29 11:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found