use strict; use warnings; use Getopt::Long qw(:config no_ignore_case); use Pod::Usage; my %opt; my ( $opt_help, $opt_man, $opt_versions ); GetOptions( [...] 'P|password=s' => \$opt{Pass}, [...] 's|snmp=s' => \$opt{snmp}, [...] 'username=s' => \$opt{user}, [...] 'help!' => \$opt_help, 'man!' => \$opt_man, 'versions!' => \$opt_versions ) or pod2usage( -verbose => 0 ); if ( defined $opt_help ) { pod2usage( -verbose => 99, -sections => "OPTIONS/PASSWORD MODE" ) if defined $opt{Pass}; pod2usage( -verbose => 99, -sections => "OPTIONS/SNMP MODE" ) if defined $opt{snmp}; pod2usage( -verbose => 99, -sections => "OPTIONS/TELNET SSH MODE" ) if ( defined $opt{user} or defined $opt{pass} ); } pod2usage( -verbose => 1 ) if defined $opt_help; pod2usage( -verbose => 2 ) if defined $opt_man; [...] __END__ =head1 NAME [...] =head1 SYNOPSIS [...] =head1 DESCRIPTION [...] =head1 OPTIONS [...] =head2 PASSWORD MODE To activate B, use the -P option. [...] =head2 SNMP MODE To activate B, use the -s option. [...] =head2 TELNET SSH MODE To activate B, use the -p option without -s. [...] =cut