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