That will be 200 US dollars, payable to the Perl Foundation.
use 5.020; use Regexp::Grammars; my $input = <<'...'; input abc10; output wireax; checkinst_0( .port1(wireY), .port2(wireZ), .port3(wireX), .port4(port711), .port10 ); checkinst_2( .port5(wireYx), .port6(wireZ), .port7(wireaX), .port8(abc10), .port11 ); checkinst_3( .port100(wireYd), .port101(wireZS), .port102(wireXW), .port103(port10), .port12 ); ... my $parser = qr{ <start> <rule: start> <input> <output> <[checkinst]>+ <rule: input> input <identifier> ; <rule: output> output <identifier> ; <rule: checkinst> <checkinstid> [(] <ports> [)]; <rule: ports> <[port]>+ % , <rule: port> <portid> <parens>? <rule: parens> [(] <identifier> [)] <token: identifier> \w+\d* <token: checkinstid> checkinst_ \d+ <token: portid> [.]port \d+ }msx; if ($input =~ $parser) { my %r; { my $i = $/{start}{input}{identifier}; my $o = $/{start}{output}{identifier}; $r{top} = { source => [$i, $o], dest => [$i, $o], }; } { my @implicit; for my $checkinst ($/{start}{checkinst}->@*) { for my $port ($checkinst->{ports}{port}->@*) { if ($port->{parens}) { push $r{$checkinst->{checkinstid}}{dest}->@*, $port->{parens}{identifier}; push $r{$checkinst->{checkinstid}}{source}->@*, $port->{portid} =~ s/^\.//r; } else { push @implicit, $port->{portid} =~ s/^\.//r; } } } $r{Implicit} = { source => \@implicit, dest => \@implicit, }; } } __END__ %r = ( checkinst_0 => { dest => [qw(wireY wireZ wireX port711)], source => [qw(port1 port2 port3 port4)], }, checkinst_2 => { dest => [qw(wireYx wireZ wireaX abc10)], source => [qw(port5 port6 port7 port8)], }, checkinst_3 => { dest => [qw(wireYd wireZS wireXW port10)], source => [qw(port100 port101 port102 port103)], }, Implicit => { dest => [qw(port10 port11 port12)], source => [qw(port10 port11 port12)], }, top => { dest => [qw(abc10 wireax)], source => [qw(abc10 wireax)] }, )

In reply to Re^3: How to check for the connectivity using hash by daxim
in thread How to check for the connectivity using hash by prk

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.