Hi all,
Yesterday I think I asked a a bit more than what I should have. Since then I have broken down the problem considerably, and here is where I'm at.
I have some variables that I need to modify then replace. They are
$runset{"POWER-NODE"}="vdd,vdda";
$runset{"GROUND-NODE"}="vssa,vss";
Now I have a line in a text file that I want to modify
$line = "*.PIN foo:I bar:O vdd:I vssq:I vssa:O";
The rules are simple
For any variables in $runset{"POWER-NODE"}
that match the core word in $line will become
"variable:P" so in this case $runset{"POWER-NODE"} vdd becomes vdd:P and vdda becomes vdda:P in
$line
This would produce..
$line = "*.PIN foo:I bar:O vdd:P vssq:I vssa:O";
For any variables in $runset{"GROUND-NODE"}
that match the core word in $linewill become
"variable:G" so in this case $runset{"GROUND-NODE"}
vssa becomes vssa:G and vss becomes vss:G in $line
This would produce..continuing from previous
$line = "*.PIN foo:I bar:O vdd:P vssq:I vssa:G";
Notice that only those variables that exist in both
$line and
$runset{pwr/gnd} were changed. Also I don't want to actually change the
$runset variables only temporarily modify them.
I hope this is simpler to understand. I think this isn't tough but I am really stuck on this thing..
Any help would be very much appreciated. Thanks to every one so far that has tried to read through my kludge and help me 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.