#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