Gary, Thanks for your response.. those variables are only one for file..
say file1 have only <ABC_IFILE> and file 2 have only <ASD_IFILE> like this i have 100 files... i want a common search and replace to replace <*_IFILE> with new value.. i have common one like <IMPORT_IFILE> in all the files, for this i am doing following s/<IMPORT_IFILE>/$in_out_file_path/ if (m/<IMPORT_IFILE>/); similarly, i want to replace following this with <ABC_IFILE> <ASD_IFILE> new value.. I don't want to use following s/<ABC_IFILE>/$in_out_file_path/ if (m/<ABC_IFILE>/); s/<ASD_IFILE>/$in_out_file_path/ if (m/<ASD_IFILE>/); because here ABC, ASD will change each time.. inly "_IFILE>" is fixed and common for all.. How to replace this ? --- James Edward Gray II <[EMAIL PROTECTED]> wrote: > 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> > > __________________________________ Do you Yahoo!? Win a $20,000 Career Makeover at Yahoo! HotJobs http://hotjobs.sweepstakes.yahoo.com/careermakeover -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>