To read arguments from a PERL script you use the environment variable ARGV.

  • Arguments are stored in the array @ARGV
    • First Argument: $ARGV[0]
    • Second Argument: $ARGV[1]
    • Third Argument: $ARGV[2]
    • etc.
  • Example
    • ./ arg1 num2 bob
      • $ARGV[0] == "arg1"
      • $ARGV[1] == "num2"
      • $ARGV[2] == "bob"
  • To get the total number of arguments
    • $numberOfArguments = $#ARGV + 1;
  • To read all arguments as one string
    • $arg_string=join(' ',@ARGV);

From HowTo Wiki, a Wikia wiki.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.