manish.rathi has asked for the wisdom of the Perl Monks concerning the following question:
I want to enter file names to be worked with dynamically i.e I dont want to provide file names at the begnning of the program. I have written following code, but its not working properly.
print "file1 ="; $file1=<stdin>; print "file2 =" ; $file2=<stdin>; @ARGV = {"$file1", "$file2"} ; chomp($remove = <stdin>); chomp($replace = <stdin>); while(defined($line=<>)){ $line =~ s/$remove/$replace/g; print "$line"; }
Pls let me know whats wrong.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: providing filenames dynamically
by ysth (Canon) on Feb 24, 2009 at 05:33 UTC | |
|
Re: providing filenames dynamically
by balakrishnan (Monk) on Feb 24, 2009 at 06:01 UTC | |
|
Re: providing filenames dynamically
by PoorLuzer (Beadle) on Feb 24, 2009 at 05:30 UTC | |
|
Re: providing filenames dynamically
by Anonymous Monk on Feb 24, 2009 at 08:49 UTC | |
|
Re: providing filenames dynamically
by apl (Monsignor) on Feb 24, 2009 at 13:23 UTC | |
|
Re: providing filenames dynamically
by Marshall (Canon) on Feb 24, 2009 at 15:26 UTC |