in reply to generic getopt to hash
But of course! Otherwise, how does it know that --name needs a value? or that --list takes more than one value? This is the way the getopt libraries work. If you want different, you will likely have to write your own. Simply, it might look like this:
sub magic_opts { my ($lastopt,%opthash); for (split) { if (/^-+(.*)/) { $lastopt=$1; $opthash{$lastopt}=[]; } else { push @{$opthash{$lastopt}}, $_; } } return \%opthash; }
Of course this code is buggy, specifically it does not handle the case if there was no previous --option. Good luck!
| print pack("A25",pack("V*",map{1919242272+$_}(34481450,-49737472,6228,0,-285028276,6979,-1380265972))) |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: generic getopt to hash
by ikegami (Patriarch) on Oct 01, 2009 at 18:41 UTC | |
|
Re^2: generic getopt to hash
by Anonymous Monk on Oct 01, 2009 at 19:56 UTC |