On May 4, 2004, at 10:54 AM, Madhu Reddy wrote:
Hi, in a file, I have following variables,
<ABC_IFILE> <ASD_IFILE> <XYZ_IFILE> <QWE_IFILE>
I want to replace those variables with values
basically i want to replace all <*_IFILE> with some value say file.txt
How to do this in perl ?
If memory isn't an issue, the easy way is to load a hash by the keys you list (ABC, ASD, XYZ, QWE, etc.), with the values being the replacements. Then just walk the key list with a super simple regex.
If memory is an issue, I suggest matching the keys, then handing them of to a subroutine that fetches the replacement for you. The /e regex modifier can help with this.
If you have trouble with your code, please send it in.
James
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>