#! /usr/bin/perl

use Getopt::Std;
use warnings;
use strict;

sub read_from_sh($) {
my $file = shift;
my @files = ();
open F, $file or die "Could not open $file: $!";
while (<F>) {
next if /^\s*$/;
push @files, $_;
}
close F or die "Could not close $file: $!";
return @files;
}

my @files;
my %opts = ();
getopts("s:", \%opts);
if ($opts{'s'}) {
@files = read_from_sh($opts{'s'});
}else {
@files = @ARGV;
}
for my $file (@files) {
print "file: $file\n";
}

export.pl同级目录下: chage.csv chage2.csv txt.txt t.txt

>perl export.pl chage.csv chage2.csv txt.txt t.txt

OUTPUT:

file:export.pl

file:chage.csv

chage2.csv

file:txt.txt

file:t.txt

【转载】perl接受传递参数的方法的更多相关文章

  1. jsp中四种传递参数的方法

    jsp中四种传递参数的方法如下: 1.form表单 2.request.setAttribute();和request.getAttribute(); 3.超链接:<a herf="i ...

  2. Jsp传递参数的方法

    今天老师讲了jsp中四种传递参数的方法,我觉得总结一下,挺好的,以备后用! 1.form表单 2.request.setAttribute();和request.getAttribute(); 3.超 ...

  3. C++向main函数传递参数的方法(实例已上传至github)

    通常情况下,我们定义的main函数都只有空形参列表: int main(){...} 然而,有时我们确实需要给mian传递实参,一种常见的情况是用户设置一组选项来确定函数所要执行的操作.例如,假定ma ...

  4. Javascript 定时器调用传递参数的方法

    文章来源:  https://m.jb51.net/article/20880.htm 备注:先记下,以后整理: Javascript 定时器调用传递参数的方法,需要的朋友可以参考下. 无论是wind ...

  5. JSP页面之间传递参数的方法有哪些?

    JSP页面之间传递参数的方法有哪些? 解答: 1)request 2)session 3)application 4)提交表单 5)超链接

  6. php cli传递参数的方法

    php cli传递参数的方法 <pre>$options = "f:g:"; $opts = getopt( $options ); print_r($opts); & ...

  7. springMVC controller间跳转 重定向 传递参数的方法

    springMVC controller间跳转 重定向 传递参数的方法 spring MVC框架controller间跳转,需重定向.有几种情况:不带参数跳转,带参数拼接url形式跳转,带参数不拼接参 ...

  8. Django URL传递参数的方法总结(转)

    1 无参数情况 配置URL及其视图如下: 1 2 3 4 (r'^hello/$', hello)   def hello(request): return HttpResponse("He ...

  9. (转)JSP中四种传递参数的方法:

    1.form表单 2.request.setAttribute();和request.getAttribute(); 3.超链接:<a herf="index.jsp"?a= ...

随机推荐

  1. nohup和&的区别

    nohup和&的区别http://bbs.chinaunix.net/forum.php?mod=viewthread&tid=4241330&fromuid=21288388 ...

  2. Ubuntu中Apache修改DocumentRoot(修改网站根目录)

    今天配置好Apache+PHP+MySQL但是apache默认DocumentRoot是/var/www想把它改到我Windows下进行测试的k:/wwwroot把 apache2.conf 翻了好几 ...

  3. 在Xcode6.1.1模拟器中点击UITextView不出现软键盘?

    使用Xcode6.1.1做一个小项目时,在storyboard中添加了一个UITextField,使用模拟器运行后,点击UITextField出现光标,也可以从外接键盘上输入文字,但是就是不出现软键盘 ...

  4. iOS面试必看,最全梳理

    序言 目前形势,参加到iOS队伍的人是越来越多,甚至已经到供过于求了.今年,找过工作人可能会更深刻地体会到今年的就业形势不容乐观,加之,培训机构一火车地向用人单位输送iOS开发人员,打破了生态圈的动态 ...

  5. iOS - (简单平移动画/弹出View的使用)

    在iOS 开发中,使用平移动画的频率越来越高,给人的感觉就是很炫酷很流畅,起到增强用户体验的作用.在APP开发中实现动画效果有很多种方式,但我目前是使用较多的是平移动画,顺便也在此做一些小小的总结,大 ...

  6. Spring Security HTTP Basic for RESTFul and FormLogin (Cookies) for web - Annotations

    @Configuration @EnableWebMvcSecurity @EnableGlobalMethodSecurity(securedEnabled = true, prePostEnabl ...

  7. 关于django post表单

    CSRF verification failed. Request aborted. 默认会出现该状况,解决办法: 1. 使用requestcontext from django.template i ...

  8. [Call Vibrator] How to Enable Outgoing Call Vibration without ROOT

    Call Vibrator requires the radio log of phone to detect when outgoing call is answered. But since An ...

  9. Redo丢失场景和处理方法

    Redo丢失场景和处理方法 Type of Failure Status Column of V$LOG Action One member failed in multiplexed group N ...

  10. Jquery系列教程

    最近想重新温习下Jquery,发现园子里有个很棒的系列教材,所以Mark下来. 转载自:http://www.cnblogs.com/zhangziqiu/tag/jQuery%E6%95%99%E7 ...