Getopt::Long - Extended processing of command line options
use
Getopt::Long;
my
$data
=
"file.dat"
;
my
$length
= 24;
my
$verbose
;
GetOptions (
"length=i"
=> \
$length
,
# numeric
"file=s"
=> \
$data
,
# string
"verbose"
=> \
$verbose
)
# flag
or
die
(
"Error in command line arguments\n"
);
DESCRIPTION
The Getopt::Long module implements an extended getopt function called GetOptions(). It parses the command line from @ARGV
, recognizing and removing specified options and their possible values.
my
$verbose
=
''
;
# option variable with default value (false)
my
$all
=
''
;
# option variable with default value (false)
GetOptions (
'verbose'
=> \
$verbose
,
'all'
=> \
$all
);
The option name as specified to the GetOptions() function is called the option specification. Later we'll see that this specification can contain more than just the option name. The reference to the variable is called the option destination.
The call to GetOptions() parses the command line arguments that are present in @ARGV
and sets the option variable to the value 1
if the option did occur on the command line. Otherwise, the option variable is not touched. Setting the option value to true is often called enabling the option.
GetOptions() will return a true value if the command line could be processed successfully. Otherwise, it will write error messages using die() and warn(), and return a false result.
Getopt::Long - Extended processing of command line options的更多相关文章
- getopt--parse command line options
getopt解析命令行选项 getopt, getopt_long, getopt_long_only, optarg, optind, opterr, optopt - Parse command- ...
- IAR Build from the command line 环境变量设置
http://supp.iar.com/Support/?Note=47884 Technical Note 47884 Build from the command line The alterna ...
- An annotation based command line parser
Java命令行选项解析之Commons-CLI & Args4J & JCommander http://rensanning.iteye.com/blog/2161201 JComm ...
- List of Chromium Command Line Switches(命令行开关集)——官方指定命令行更新网址
转自:http://peter.sh/experiments/chromium-command-line-switches/ There are lots of command lines which ...
- Cookies with curl the command line tool
w https://curl.haxx.se/docs/http-cookies.html curl has a full cookie "engine" built in. If ...
- Linux command line exercises for NGS data processing
by Umer Zeeshan Ijaz The purpose of this tutorial is to introduce students to the frequently used to ...
- C++: Command Line Processing
Save this code here for studying and using it. Surce code is here. CmdLine.h File #pragma once #incl ...
- [笔记]The Linux command line
Notes on The Linux Command Line (by W. E. Shotts Jr.) edited by Gopher 感觉博客园是不是搞了什么CSS在里头--在博客园显示效果挺 ...
- Yandex Big Data Essentials Week1 Unix Command Line Interface Processes managing
free displays the total amount of free and used memory free [options] top provides a dynamic real-ti ...
随机推荐
- QQ群985135948入群密码
QQ群985135948入群密码:键盘第三排从左往右依次按过去,就是密码 点下面这个键应该可以进群哦!
- SCSS的基本操作
Sass是成熟.稳定.强大的CSS预处理器,而SCSS是Sass3版本当中引入的新语法特性,完全兼容CSS3的同时继承了Sass强大的动态功能. 特性概览 CSS书写代码规模较大的Web应用时,容易造 ...
- Your wechat account may be LIMITED to log in WEB wechat, error info: <error><ret>1203</ret><message>为了你的帐号安全,此微信号不能登录网页微信。你可以使用Windows微信或Mac微信在电脑端登录。Windows微信下载地址:WeChat for PC
转载:https://zhuanlan.zhihu.com/p/76180564 微信网页版限制登录或禁止登录将影响一大批使用itchat等Web Api方案的微信机器人 网页版微信 API 被封了, ...
- mybatis(五):源码分析 - mapper文件加载流程
- Python中读取目录里的文件并按排序列出
1.os.listdir():用于返回指定的文件夹包含的文件或文件夹的名字的列表. 如: dir ='F:/Home_01/img'#当前目录 filenames=os.listdir(dir)#fi ...
- python lambda ,map详解
lambda 匿名函数 # 普通定义函数 def func1(x,y): return x+y # 执行函数 print(func(1,2)) # 如果此函数只调用一次,或者功能简单,此方法就显得笨拙 ...
- tomcat8.5和redis实现session共享
1. 问题 由于之前看其他资料配置的session共享没注意自己tomcat的版本所以出现了诸多问题,tomcat8.5和之前版本的配置是不一样的. 2. 配置 ①将如图所示三个jar包放入t ...
- OpenGL基本图元类型
GL_POINTSGL_LINESGL_LINE_STRIPGL_LINE_LOOPGL_TRIANGLESGL_TRIANGLE_STRIPGL_TRIANGLE_FANGL_QUADSGL_QUA ...
- 自制yum源离线安装ansible
适应场景 在实际生产环境中,服务器往往是不能访问互联网,如果简单的下载ansible源码安装,会碰到缺少各种依赖包的问题,因此,推荐制作yum源,然后使用yum安装ansible. 实验环境 模拟可以 ...
- c数据结构 -- 使用链表实现计数
#include <stdio.h> #include <stdlib.h> typedef struct _node{ int value; struct _node *ne ...