[vox-tech] Perl's GetOpt package - Short and long arguments

Bryan Richter btrichter at ucdavis.edu
Sat Nov 27 12:25:37 PST 2004


Peter Jay Salzman wrote:
> I want to implement long args (--argument) and short args (-a) in my
> program that analyzes data generated from the PDE solver I wrote.
> 
> Can Perl's GetOpt::Std and GetOpt::Long co-exist peacefully?

I would normally have no idea, since I don't do Perl programming, but since I
was recently looking at /usr/bin/rename (which, on Debian unstable, is a Perl
script), I give you this snippet:

/usr/bin/rename
---
use strict;

use Getopt::Long;
Getopt::Long::Configure('bundling');

my ($verbose, $no_act, $force, $op);

die "Usage: rename [-v] [-n] [-f] perlexpr [filenames]\n"
    unless GetOptions(
	'v|verbose' => \$verbose,
	'n|no-act'  => \$no_act,
	'f|force'   => \$force,
    ) and $op = shift;
---

I think that might answer your question.

-Bryan
-- 
Bryan Richter
UCDTT President
UC Davis Undergrad, Physics Dept.
-
A PGP signature is (probably) attached to this email. 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: Digital signature
Url : http://ns1.livepenguin.com/pipermail/vox-tech/attachments/20041127/3083b6aa/attachment.bin


More information about the vox-tech mailing list