in reply to Simple replacement - only if they exist..
Then use this table to modify your input $line.%rs = ( vdd => 'P', vdda => 'P', vssa => 'G', vss => 'G', );
/prakash$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;
|
|---|