Perl sys.argv issue

I am running a perl script and reading the arguments passed to the script as below. .... resembles more arguments.

java weblogic.WLST /web/update.py 34 56 ....

I am trying to print the arguments passed to the update.py script as below

    for arg in sys.argv:
        print "other args:", arg

Output:

I do not want the script name /web/update.py to be printed in the loop only the arguments passed to the .py should be printed i.e 34 & 56 ...

Can you please suggest a solution ?

It is part of argv, though, by about 50 years of tradition. Do a loop from 1 to len(sys.argv) instead to avoid it.

1 Like