how to extract pattern

1. .xxx ( $analog_atop_io[n] ) .or. 2. .ooo ( {$analog _atop_io[m], $analog _atop_io[m+1], $analog _atop_ +io[m+2], …} )
to $analog_atop_io[n], $analog _atop_io[m], $analog _atop_io[m+1], $an +alog _atop_io[m+2], … and then put into array @analog _atop_io
analog_atop u_analog_atop (.PAD_VDDA ( PAD_VDDA ) , , .LNA1_CURSET ( {n_IP_protect_573 , n_IP_protect_572 } ) , .CTL_CXI_XO24M ( {n662 , n447 , n449 , n2478 } ) , .CTL_SYNTH_EN ( n_IP_protect_313 ) , .CTL_CXO_XO24M ( {n2705 , n439 , n441 , n443 } ) , , .DPAD_VSS_TEMPSENSE ( DPAD_VSS_TEMPSENSE ) , .PAD_ADGPIO_2 ( PAD +_ADGPIO_2 ) ) ;

following is my code , but fail to extract ! (nothing captured)

#!/usr/bin/perl #use 5.010; use strict; use warnings; use List::MoreUtils qw(uniq); my $reS = qr{\..* \( (.*) \)}s; my $reM = qr{\..* \( \{ (.*) \} \)}s; #my $re = qr{TEXT;\s+LAYER 13[1-7];\s+TEXTTYPE 0;.*?STRING ([^;:]+)}s; open my $fh, "analog_atop_inst.v" or die $!; my @fields=(); my $i=0; { local $/ = ""; while (<$fh>) { $fields[$i] = $1 , $i++ if /$reM/; } } @fields = sort @fields; @fields = uniq (@fields); open(output_1, ">analog_atop_io".".txt") or die "can't open analog_ato +p_io\n"; foreach my $field (@fields){ $field .= "\n"; print output_1 $field ; #print $field ;

In reply to how to extract multiple pattern into array by herman4016

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.