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 ...
随机推荐
- (转)java 虚拟机内存划分
深入理解java虚拟机(一):java内存区域(内存结构划分)深入理解java虚拟机(二):java内存溢出实战 深入理解java虚拟机(三):String.intern()-字符串常量池深入理解j ...
- JUC之CountDownLatch和CyclicBarrier的区别 (转)
CountDownLatch和CyclicBarrier的功能看起来很相似,不易区分,有一种谜之的神秘.本文将通过通俗的例子并结合代码讲解两者的使用方法和区别. CountDownLatch和Cycl ...
- macOS系统下安装ChromeDriver
1.对应的chrome浏览器需要安装对应的驱动,对应列表如下: chromedriver版本 支持的chrome版本 v2.43 v69-71 v2.42 v68-70 v2.41 v ...
- 白面系列 mongoDB
mongoDB和redis一样,都是noSQL技术之一. redis是Key-Value存储,mongoDB是文档存储. 文档存储一般用类似json的格式存储,存储的内容是文档型的.文档是一组键值(k ...
- vue使用kkfileview文件预览功能
1.环境要求: java 1.8+ 2.部署运行: 本机以及虚拟机上运行: 1.从https://gitee.com/kekingcn/file-online-preview/releases地址下载 ...
- importing-cleaning-data-in-r-case-studies
目录 importing-cleaning-data-in-r-case-studies 导入数据 查看数据结构 下面的一些都是查数据结构的 separate 拆分单元格 读取指定位置的数据 stri ...
- Andre Weil的一生
在20世纪的数学家中,Andre Weil(1906-1998)以其渊博的学识.坎坷的经历和超凡的人格魅力成为引人注目的一员. 他无疑是20世纪最伟大的数学家之一.国际数学家大会把数学划分为19个大的 ...
- Python实现求多个集合之间的并集
目的:求多个集合之前的并集,例如:现有四个集合C1 = {11, 22, 13, 14}.C2 = {11, 32, 23, 14, 35}.C3 = {11, 22, 38}.C4 = {11, ...
- 【C语言】思维导图
长按图片或右键另存为保存哦(´-ω-`)
- Python之旅第二天(第一天补充部分、数据类型、运算逻辑、部分方法的引入、pycharm)
今天其实是有点小忙的,但是干自己不喜欢事情的结果就是,要睡觉了都不知道自己在忙鸡毛,所以还是不继续想了,脑仁疼.回忆一下今天的学习内容,着实有点少,本大侠还没怎么过瘾呢.废话不多说. while补充两 ...