[EMAIL PROTECTED] wrote:
Hello,
I am trying to write a search and replace script that can accept multiple arguments, but i want the first argument to be the filename to read, the next one to be the string to search for, the next one to be the replacement string, and the last one to be the name of the new file it creates with the new changes, but i can't figure out how to seperate each argument, can some one tell me how to do something like this. Any help is very much
VIA CLI:
./replace.pl /home/oldfile "my dog spot" "your cat wiskers" /home/newfile
then in your script the are, in the the same order :
$ARGV[0] $ARGV[1] $ARGV[2] $ARGV[3]
There are modules to assist you with command line arguments as well at search.cpan.org (like using switches so that order doesn't matter, etc)
HTH :)
Lee.M - JupiterHost.Net
appreciated.
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>