The "GetMultiOpts(\@eArray)" passes a reference to an array to the GetMultiOpts sub so that it knows which array to put the arguments in. Once it is invoked, it puts any arguments it finds into the array passed to it until it hits another switch, then it passes control back to the first loop. What I was thinking was that that way you could just keep sucking arguments into the switch until you hit the next one without using the quotes or commas, if that was what you wanted. It was really more of a proof of concept than anything else, though. You guys are definitely right about sticking with GetOpts as much as possible, because it probably has thought of all the gotchas and that way you don't reinvent the wheel, just the axle.
-----Original Message----- From: Harry Putnam To: [EMAIL PROTECTED] Sent: 6/20/02 9:36 AM Subject: Re: getopt that handles more arguments per option Timothy Johnson <[EMAIL PROTECTED]> writes: > sub GetMultiOps{ > $ref = $_[0]; > while($ARGV[0] !~ /^-\w$/){ > $_ = shift @ARGV; > push @{$ref},$_; > } > } > > ### END ##################### > > Which should theoretically give you one array for each option and one array > as a catch-all to use for all of the elements not associated with an option. Yeah, that does look like a better approach, though I'm not really catching what this bit actually does: `GetMultiOps(\@eArray)'. Not familiar with the syntax. I think I see the intent though. I'm now thinking this might be better if used with regular Getopt::Std like: if ($opt_e) { $opt_e would be the first and get shifted by Getopt::Std Then trot out your sub for any others. Resetting ARGV as you go. } I think that would allow the existing Getopt::Std to work its magic and take care of any undesired looping you mentioned. So really just `while looping' away any extra args at each option. I haven't implemented this but I think it will work and be cleaner and less error prone. Your sub idea is vastly superior to if/elsing till I puke. Thanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]