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

Peter Jay Salzman p at dirac.org
Sat Nov 27 13:56:37 PST 2004


On Sat 27 Nov 04, 12:25 PM, Bryan Richter <btrichter at ucdavis.edu> said:
> Peter Jay Salzman 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.

Indeed!

This wasn't in any of my Perl refs.  A great thing to know.  Thanks for the
great tip!

Pete

-- 
The mathematics of physics has become ever more abstract, rather than more
complicated.  The mind of God appears to be abstract but not complicated.
He also appears to like group theory.  --  Tony Zee's "Fearful Symmetry"

PGP Fingerprint: B9F1 6CF3 47C4 7CD8 D33E  70A9 A3B9 1945 67EA 951D


More information about the vox-tech mailing list