#Assuming that $variable contains the value to match for #( Something from $runset{GROUND-NODE} ) . . . $line =~ s/ #The substitution operator $variable #vssa, vss, etc . . . : #a colon . #any character (I, O, etc) / #substituted by . . . $variable #as before : #as before G #the G because it's in GROUND-NODE /xg; #Substitute globally #### #Complete code! #(Almost . . .) # @lines contains the *PIN lines . . . foreach $PIN (@lines) { foreach $ground_var (split /,/, $runset{GROUND-NODE}) { $PIN =~ s/$ground_var:./$ground_var:G/g; } foreach $power_var (split /,/, $runset{POWER-NODE}) { $PIN =~ s/$power_var:./$power_var:P/g }