Questions about this topic? Sign up to ask in the talk tab.

Perl/Basics/User Input/Command Line/Getopt::Std/Code

From NetSec
Revision as of 03:11, 16 July 2012 by AlizaLorenzo (Talk | contribs) (Created page with "{{code|text=<source lang="perl"> use strict; use warnings; use Getopt::Std; my %opts; getopts('m:b',\%opts); print $opts{m} . "\n"; print "The boolean -b option was set!\n" if ...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
 
use strict;
use warnings;
use Getopt::Std;
 
my %opts;
getopts('m:b',\%opts);
 
print $opts{m} . "\n";
print "The boolean -b option was set!\n" if defined $opts{b};
print "The boolean -b option was not set!\n" if undef $opts{b};