in reply to How can we read input argument file to a script from its main library?

See Getopt::Long and/or perlvar on @ARGV maybe?

If that doesn't answer your question, can you maybe post a 10 line script that demonstrates the problem you have?

  • Comment on Re: How can we read input argument file to a script from its main library?
  • Download Code

Replies are listed 'Best First'.
Re^2: How can we read input argument file to a script from its main library?
by Meena212 (Initiate) on Mar 21, 2017 at 08:39 UTC
    Hi root, Thanks for your help. I have an idea of how handle command line arguments given to a script. Kindly go through the problem and background as below: Background : A script written to perform operation and all the depending subroutines for the script are in main library. Here no input arguments were accepted Problem : Now the input to file is an XML file. But I don't want to modify anything in local script. whereas when I call the script with xml file as a command line input, I should be able to read it directly in library. Is there a way to do this?

      Have you looked at Getopt::Long and @ARGV?

      What problems do you have applying the ideas discussed there to your program?

      Maybe you also want to look at perlsub to find how to pass parameters to subroutines?

        This is not the problem. In simple terms, can we use ARGV[0] of the local script directly in library?