Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

easy substitute question

Status
Not open for further replies.

theSeeker03

Programmer
Jan 16, 2004
17
US
ok, for some reason I could not find this example in O'Reily book.

I want to substitute every string of "==" to be "|", in $_

so I say:

s/==/|/;

but that only substitutes the first occurence of "==", not all of them. How do you substitute all of them?
 
You use the [tt]g[/tt] modifier to the regexp.

Code:
s/==/|/g;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top