1 类似着这样的写法
#!/usr/bin/perl -w
use strict;
use warnings;
my $usage=<<USAGE;
Usage:
perl $0 inputfile
USAGE
if(@ARGV==0){die $usage};
my $file=$ARGV[0];
2 类似这样的写法
#!/usr/bin/perl -w
use strict;
use warnings;
use Getopt::Long;
use POSIX;
my ($input,$output_dir,$seq_num,$file_num,$help,@libfiles);
GetOptions(
"i:s" => \$input,
"o:s" => \$output_dir,
"n:i" => \$seq_num,
"m:i" => \$file_num,
"h:s" => \$help,
"library=s" => \@libfiles
);
die `pod2text $0` if ((!$input) or (!$output_dir));
#帮助文档
=head1 Description
This script is used to split fasta file, which is too large with thousangs of sequences;
=head1 Usage
$0 -i <input> -o <outpu_dir> [-n <seq_num_per_file>] [-m <output_file_num>] -h --library lib/stdlib --library lib/extlib
=head1 Parameters
-i [str] Input raw fasta file
-o [str] Output file to which directory
-n [int] Sequence number perl file, alternate chose paramerter
-m [int] Output file number (default:100)
-h [str] Help manual
--library [dir] Directory with multiple values
=cut
# ! 代表否定
# s 代表字符串
# i 代表整型
# f 代表浮点数
#--library 用于传多个参数
print $input,"\n";
print $output_dir,"\n";
print $seq_num,"\n";
print $file_num,"\n";
@libfiles = split(/,/,join(',',@libfiles));
for my $i (0..$#libfiles){
print $libfiles[$i],"\n";
}