parsing command line args



folks,

when i give a command-line of:
/tmp/test.pl -arg1 -arg2 -arg3 'value with spaces'
to unix-shell, my perl script has access to the command-line arguments
in the following neat array:

0 ARRAY(0x12b06c)
0 '-arg1'
1 '-arg2'
2 '-arg3'
3 'value with spaces'

now if i have a string for the command-line:

$cmd_str = "/tmp/test.pl -arg1 -arg2 -arg3 'value with spaces'" ;

any ideas on parsing the $cmd_str into a @ARGV array i have shown
above?

thanks,
-badari

.



Relevant Pages

  • Re: parsing command line args
    ... my perl script has access to the command-line arguments ... in the following neat array: ... parsing of the command-line by many unix shells (which is exactly ...
    (comp.lang.perl.misc)
  • Re: parsing command line args
    ... my perl script has access to the command-line arguments ... in the following neat array: ... any ideas on parsing the $cmd_str into a @ARGV array i have shown ...
    (comp.lang.perl.misc)
  • Re: parsing command line args
    ... to unix-shell, my perl script has access to the command-line arguments ... in the following neat array: ...
    (comp.lang.perl.misc)
  • Re: FAQ 5.2
    ... and write the array out to a new file, specifying the fileon the ... the idea is to get the lines into an array and modify the ... Posted Via Usenet.com Premium Usenet Newsgroup Services ...
    (comp.lang.perl.misc)
  • Re: Perl script finds module in Terminal but not as CGI?
    ... Why would Perl script on the command-line find it but not a CGI executable? ... installed Date::Manip so my normal bash shell is picking it up. ... Got to rewrite a bit of code now (rather have it portable than tied in to only Macs with Fink). ...
    (uk.comp.sys.mac)