Rhodium has asked for the wisdom of the Perl Monks concerning the following question:
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!
The <it>seeker</it> of perl wisdom.
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Adding elements to an array from an array
by thelenm (Vicar) on May 01, 2002 at 18:05 UTC | |
|
Re: Adding elements to an array from an array
by perlplexer (Hermit) on May 01, 2002 at 18:19 UTC | |
|
Re: Adding elements to an array from an array
by Mr. Muskrat (Canon) on May 01, 2002 at 18:15 UTC | |
|
Re: Adding elements to an array from an array
by particle (Vicar) on May 01, 2002 at 18:44 UTC | |
by Rhodium (Scribe) on May 01, 2002 at 20:00 UTC | |
by CharlesClarkson (Curate) on May 02, 2002 at 03:05 UTC | |
|
Re: Adding elements to an array from an array
by mr.8 (Initiate) on May 01, 2002 at 20:38 UTC | |
by thelenm (Vicar) on May 01, 2002 at 20:54 UTC |