2
我是getopt:long的新手。我試圖通過命令行指定變量,但不知道如何聲明變量。請參閱下面的錯誤。Perl Getopt :: Long ::描述 - 如何聲明變量
任何幫助表示讚賞,
感謝
$ perl的make_keggTable.pl -i ko2genes.pau -o加索爾
全局符號 「$ inlocus」 需要在make_keggTable.pl線126明確包名。
全局符號「$ inlocus」需要在make_keggTable.pl線126
全局符號「$ orgCode」需要在make_keggTable.pl行明確包名133
全局符號「$ orgCode」需要明確的packag明確包名在make_keggTable.pl線146
use strict;
use warnings;
use Data::Dumper;
use Getopt::Long::Descriptive;
#use Getopt::Long;
#use Pod::Usage;
## usage and help info
my ($opt, $usage) = describe_options(
'make_keggTable.pl %o',
[ 'inlocus|i=s', 'file of NCBI locus IDS to Kegg KOs' ],
[ 'orgCode|o=s', 'kegg organism code(Pseu.PA14=pau, Pseu.PA01=pae,Salm.14028S=seo,Salm.LT2=stm,Ecoli.MG1655=eco)'],
[],
[ 'verbose|v', 'print with verbosity' ],
[ 'help', 'print usage message and exit' ],
);
if ($opt->help) {
print $usage->text, "\n";
}
##
### read in NCBIgenID to KO for organism
# pau:PA14_00010 K02313
#my $inlocus=$ARGV[0] || "ko2genes.pau";
#my $orgCode=$ARGV[1] || "pau";
open (IN, $inlocus) or die "cannot open $inlocus\n";
my %HoLoc2ko;
while (my $line =<IN>){
next if ($line =~ /^\s*$/);
next if ($line =~ /^#/);
chomp $line;
my ($locus,$ko)=split(/\s/,$line);
$locus =~ s/$orgCode//;
if ($ko =~ /ko:/) {
$ko =~ s/ko:// ;
}
if (defined($locus) && defined ($ko)) { # leave as array although it looks like all loci are only assigned to one ko
push @{$HoLoc2ko{$locus}},$ko;
}
}
close (IN);
print "read in ko info for\t".scalar(keys %HoLoc2ko)."\tNCBI locis\n";
#print "Loc2ko\n".Dumper(%HoLoc2ko)."\n";
您已在'open'之前註釋了幾行。 – devnull
但我仍然需要那些如果我使用get :: opt聲明他們作爲perl make_keggTable.pl -i ko2genes.pau -o pau? – user2814482