Hi monks

I have a text file that I read in. I am trying to add words that match two different conditions to two different lists, and I am having some problems. I am hoping you all can look this over and tell me what I'm doing wrong.

open SCH, "< $runset{SchFile}" or die "Can't open $runset{SchFile}";{ local $/ = ".ENDS\n"; } while (<SCH>) { # Only look in our subckt of intrest! if ( m/^\.SUBCKT\s+($runset{SchCell})/ ){ print "\nFound $runset{SchCell}\n"; # For each word in the whole thing see if it matches the # two lists my ($word, %seen); $word = $_; foreach $word (@_) { print "$word"; if ($word =~ m/VDD|VCC/){ print "Matched VDD $word\n"; push @PN, $word if !$seen{Power}++; }elsif ($word =~ m/VSS|GND/){ print " Matched VSS $word\n"; push @GN, $word if !$seen{GND}++; } } } } close SCH; --DATA-- .SUBCKT FOO X y Z .PININFO test VDD VDD VDD Vss vdd VSS t y foo blah blah bla .ENDS .SUBCKT test2 vdds VSS VDD .PININFO test2 2FS SEL blah blah blah .ENDS --DATA--

Thanks so much for your help!


Rhodium

The <it>seeker</it> of perl wisdom.


In reply to Adding elements to an array from an array by Rhodium

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.