Hi Monks...Any idea how to print the value of $lines outside 'for loop', because i want to print the lase updated statement....
se strict;
use warnings;
open (IN1, "<design_modify1.vhd") or die;
open (IN2, "<nets.txt") or die;
open (OUT, ">output_file.vhd") or die;
open (IN3, "<enabled_nets.txt") or die;
my @nets = <IN2>;
chomp @nets;
my @enabled_nets = <IN3>;
chomp @enabled_nets;
my $lines = "";
while (<IN1>) {
#print OUT;
foreach my $i (0..$#nets)
{
if (s/\=\>\s+$nets[$i]\,/\=\>$enabled_nets[$i]\,/) {
my $lines = $_;
print "done";
print $lines;
}
}
print OUT "$lines";
}
close (IN1);
close (IN2);
close (IN3);
close (OUT);
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|