ankit.tayal560 has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, This is not a query related to some specific code/script but in a general scenario. suppose if I am having a script in which I have defined several (3-5) paths. I want to run this script through a batch file so I make a batch file.

perl filename.pl @pause

Now if I want to pass the paths required through batch file only what should I do how can I pass paths through batch file directly into my script. any help or suggestions is appreciated.

Thanks in advance

Replies are listed 'Best First'.
Re: Batch FIle Operations
by marto (Cardinal) on Oct 21, 2016 at 08:12 UTC

    Given your recent postings I wonder if you actually need a batch file at all, or even call child perl scripts with different URLs rather than just have one perl file and the appropriate sub routines. Perhaps if you explain the complete task an alternative approach could work better. Also, I appreciate the increase in effort you have made in posting, thank you. It makes it easier for us to help you.

Re: Batch FIle Operations
by Corion (Patriarch) on Oct 21, 2016 at 06:25 UTC

    This is not a question about Perl but about the shell you're starting Perl from. Most likely, you are using cmd.exe under Windows, so you can pass in parameters to your script by using %*, which are all the parameters given to your batch file:

    perl -w filename.pl %*
Re: Batch FIle Operations
by Discipulus (Canon) on Oct 21, 2016 at 07:18 UTC
    .. or using $* if you need to set a macro, as in new=start perl C:\ulisse\ulisse.pl $*

    But batch files are a silly things, do everything in Perl, you'll be happier!

    Se also:

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.