Syntactic Confectionery Delight | |
PerlMonks |
Changing the contents of a fileby perlNinny (Beadle) |
on Feb 02, 2006 at 22:48 UTC ( [id://527483]=perlquestion: print w/replies, xml ) | Need Help?? |
perlNinny has asked for the wisdom of the Perl Monks concerning the following question:
Let us say that I have a text file with the following: elephant * -ugly /leave/this/alone elephant * /only/change/->/turkey elephant * turkey I would like to change that file to say: elephant * -ugly /leave/this/alone elephant * /only/change/->/fox elephant * fox Or a file with: elephant * -ugly /leave/this/alone elephant * /only/change/->/turkey to say: elephant * -ugly /leave/this/alone elephant * /only/change/->/fox Or a file with: elephant * -ugly /leave/this/alone elephant * turkey to say: elephant * -ugly /leave/this/alone elephant * fox As you can see, I need it to change after only an elephant * with either a / or [a-z|A-Z] and only change the last word. Suggestions?
Back to
Seekers of Perl Wisdom
|
|