hi Ravi, Try: s/attr2 (.*)\n.*attr4 (.*)\n/$2, $1/s This should put attr2 with val 4 and attr4 with val 2. Cheers, Levon Barker > -----Original Message----- > From: Ravi Malghan [mailto:rmalghan@yahoo.com] > Sent: Monday, April 28, 2003 1:30 PM > To: beginners@perl.org > Subject: help with substiution > > > Hi: I am not able to perform a substition in the > following string > > $_ = "attr1 val1\nattr2 val2\nattr3 val3"; > > I want to substitute "attr2 val2" with "attr2 val4" > s/.*(attr2 .*)\nattr3.*/"attr2 val4"/; > > The above substitution does not seem to be working. > Could somebody help? > > Thanks > Ravi > > > __________________________________ > Do you Yahoo!? > The New Yahoo! Search - Faster. Easier. Bingo. > http://search.yahoo.com > > -- > To unsubscribe, e-mail: beginners-unsubscribe@perl.org > For additional commands, e-mail: beginners-help@perl.org >Thread Previous