OpenBSD::Getopt man page on OpenBSD

Man page or keyword search:  
man Server   11362 pages
apropos Keyword Search (all sections)
Output format
OpenBSD logo
[printable version]

OpenBSD::Getopt(3p)    Perl Programmers Reference Guide	   OpenBSD::Getopt(3p)

NAME
       OpenBSD::Getopt - Process single-characters switches

SYNOPSIS
	  use OpenBSD::Getopt;

	  our($opt_o, $opt_i, $opt_f, $opt_v);
	  getopts('oifv:',
	       { 'v' => sub {
		       ++$opt_v;}
	       }

DESCRIPTION
       This is similar to getopt(3). One call to "getopts($optstring)" parses
       all the options using the $optstring as a list of simple switches
       (letter) and switches with arguments (letter followed by ":").

       Option values are directly written into local variables of the form
       $opt_S, where "S" is the switch name.

       Contrary to getopt(3), $opt_S is incremented each time the switch is
       seen, to allow for stuff like "-vv".

       An optional hash can be used as a second argument, with switches as
       keys and subs as values. When a switch is met, the sub $foo is called
       as $foo for a simple switch and as "$foo(option_value)" for a switch
       with argument.

perl v5.12.2							 June 30, 2010
[top]

List of man pages available for OpenBSD

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net