Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Lots and lots of arguments!

by graff (Chancellor)
on Dec 12, 2014 at 02:49 UTC ( [id://1110116]=note: print w/replies, xml ) Need Help??


in reply to Lots and lots of arguments!

As indicated above by roboticus If you happen to store your list of arguments in a file, or if you happen to have a process that spews the list to stdout, and if you have a *n*x-like shell and associated utilities), then you can use xargs.
cat file_with_many_args.txt | xargs your_perl_script # or process_that_spews_args | xargs your_perl_script
xargs will normalize the whitespace that separates strings in its input, so whether its 50 strings on one line or 50 lines with one string per line, or anything in between with 50 strings, your script's ARGV will have 50 elements.

Also, if you have the liberty of enhancing the usage syntax for your script, you might consider adding single option that allows for a large set of args to be read from a given file (e.g. your_perl_script -a arg_list.file

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1110116]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2024-04-25 08:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found