On May 5, 2004, at 11:03 AM, Madhu Reddy wrote:
-------------replace.pl----------- #!/bin/perl -w
# INPUT STRING my $in_str = ".import <TOLL_FREE_IFILE>";
# REPLACE STRING my $repl = "/home/madhu/apps/toll.txt";
$_=$in_str;
Why do this?
# I don't want to use following, because # "TOLL_FREE" will be changed each time #s/<TOLL_FREE_IFILE>/$repl/;
# FOLLOWING WILL NOT WORK #s/_IFILE>/$repl/;
# FOLLOWING WILL NOT WORK s/<([A-Z]+)_IFILE>/$repl/;
# HOW TO DO THIS ?
$in_str =~ s/<([A-Z_]+)_IFILE>/$repl/;
And again, using a hash will allow you to change the replacement based on the contents of $1.
James
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>