Hi Monks..
Good day to all.....
Following perl code with regex statement is not working..i.e. regex statement written to call value from file inside file is not working..why is it so???
Have any one you also encountered the same problem??? Both of the following codes are not working....i.e. it is not printing the word "matched"...
use strict;
use warnings;
open (IN1, "<design_modify1.vhd") or die;
open (IN2, "<nets.txt") or die;
my @nets = <IN2>;
while (<IN1>) {
foreach my $i (0..$#nets){
print "matched" if m/$nets[$i]/;
}
}
use strict;
use warnings;
open (IN1, "<design_modify1.vhd") or die;
open (IN2, "<nets.txt") or die;
my @nets = <IN2>;
while (<IN1>) {
foreach my $i (0..$#nets){
my $var1= $nets[$i];
print "matched" if m/$var1/;
}
}
For your reference, i am attaching other two files also here........
design_modify1.vhd has following lines of codes
enable_pad : INBUF port map (PAD => enable, Y => enable_c);
c_pad : INBUF port map(PAD => c, Y => c_c);
b_pad : INBUF port map(PAD => b, Y => b_c);
sum_pad : OUTBUF port map(D => sum_c, PAD => sum);
VCC_i_0 : VCC port map(Y => VCC_0);
VCC_i : VCC port map(Y => \VCC\);
sum_1_SUM0_0 : XOR3 port map(A => b_c, B => a_c, C => c_c, Y => su
+m_c);
carry_pad : OUTBUF port map(D => N_5, PAD => carry);
a_pad : INBUF port map(PAD => a, Y => a_c);
GND_i_0 : GND port map(Y => GND_0);
GND_i : GND port map(Y => \GND\);
sum_1_CO0_i : MAJ3 port map(A => a_c, B => c_c, C => b_c, Y => N_5
+);
nets.txt file has following codes...
a_c
b_c
c_c
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, 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, 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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.