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 ...
随机推荐
- 用MyEclipse远程debug
第一步 编辑 tomcat下的文件startup.sh文件,我的路径是 /root/apache-tomcat-6.0.24/bin/startup.sh 命令:vim startup.sh将decl ...
- java中锁与@Transactional同时使用导致锁失效的问题
示例代码 @Transactional public void update(int id) { boolean lock = redisLock.lock(id); if (!lock) { thr ...
- laravel如何向视图传递值
1.定义路由 Route::get('demo','DemoController@demo'); 2.定义控制器(内with();方法就是定义传递的值 key=>value)=>" ...
- websocket+node建立聊天室简单使用
1.建立新的文件夹dome 2.执行 npm init加载package.json文件 3.node不支持websocket所以npm install ws 下载 ws插件 4.建立index.ht ...
- python接口自动化测试之http协议(一)
1.http(超文本传输)协议:是一个基于请求与响应模式的.无状态的(不会记住每个请求的状态).应用层协议 2.url详解 https://www.baidu.com/s?ie=utf-8&f ...
- TD - 单选框 - RadioButton
基本方法 Html - 默认选中 //checked="true" - 默认选中 <input dojoType="bootstrap.form.RadioButt ...
- 分析https网页加载http资源导致的页面报错原因及其解决方案
https网页加载http资源导致的页面报错及解决方案 https是当下的网站的主流趋势,甚至像苹果这样的大公司,则完全要求用户必须使用https地址. 然而对于以前http链接来说,我们往往就存在一 ...
- 【模板】裸SPFA
SPFA可以处理带负边权的图,可以判负环,然而SPFA容易被卡,即使加了各种优化. 队列优化的贝尔福德曼:裸SPFA //SPFA #include<bits/stdc++.h> usin ...
- 【css】用css巧妙实现移动端横向滑动展示功能
前言:记得以前处理移动端横向滑动展示都是去用js去解决的,要用js进行蛮多处理,要算li的宽度,然后还要用js设置ul盒子的宽度,又要设置最大滑动距离,最小滑动距离等等.......但是现在发现用cs ...
- Web API入参,响应规范
入参绑定 入参应该定义成实体,而不是多个参数,方便扩展.[FromBody]和[FromUrl]特性也最好加上. public ActionResult<Pet> Create([From ...