Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Simple replacement - only if they exist..

by PrakashK (Pilgrim)
on Apr 11, 2002 at 17:46 UTC ( #158370=note: print w/ replies, xml ) Need Help??


in reply to Simple replacement - only if they exist..

I think it would be helpful, if you slightly change your data structure, or add a new one:

%rs = ( vdd => 'P', vdda => 'P', vssa => 'G', vss => 'G', );
Then use this table to modify your input $line.
$line = "*.PIN foo:I bar:O vdd:I vssq:I vssa:O"; $line =~ s/\b(\w+):([A-Z])\b/$rs{$1} ? "$1:$rs{$1}" : "$1:$2"/eg;
/prakash


Comment on Re: Simple replacement - only if they exist..
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://158370]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (12)
As of 2015-07-28 22:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls