我试图打开输入文件使用的Getopt参数::龙模块perl的getopt的::长文件路径
这是我的脚本
#! /usr/bin/perl -s
use strict;
use warnings;
use Data::Dumper;
local $Data::Dumper::Useqq = 1;
use Getopt::Long qw(GetOptions);;
my $input='';
GetOptions('input|in=s' => \$input);
open(my $table1,'<', $input) or die "$! - [$input]"; #input file
这年初是怎么启动脚本
$ script.pl -in /path/to/file.txt
我得到的输出:
没有这样的文件或目录 - [] at script.pl第13行。
第13行是open(...
。
脚本中是否有错误?
是的!但我认为这是这个结合,加上我的答案。 – simbabque
@simbabque:没有。如果没有'-s'' Getopt :: Long',你可以在输入文件名之前或之后输入选项 – Borodin
输入文件名是这里的选项之一。我误解了什么吗? – simbabque