File: tstopt2

package info (click to toggle)
libgetopt-mixed-perl 1.008-10
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, jessie, jessie-kfreebsd, lenny, sarge, squeeze, wheezy
  • size: 84 kB
  • ctags: 12
  • sloc: perl: 228; makefile: 38
file content (21 lines) | stat: -rw-r--r-- 595 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!perl
# $Id: tstopt2 1.1 1996/02/08 23:03:18 Madsen Exp $

BEGIN {unshift @INC, 'lib'} # So you don't have to install Getopt::Mixed first

use Getopt::Mixed 1.006, 'nextOption';

Getopt::Mixed::init("apples=f a>apples apricots=f b:i c d:s file=s f>file",
                    "pears=f help ?>help version V>version");

while (($option, $value, $asEntered) = nextOption()) {
    if (defined $value) {
        printf "%-9s %7s = %s\n",$asEntered,$option,$value;
    } else {
        printf "%-9s %7s\n",$asEntered,$option;
    }
}

Getopt::Mixed::cleanup();

print "ARGV = ",join(' ',@ARGV),"\n";