Friday, August 24, 2012

Perl - Getopt::Long

#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long;

my $output_dir;
my $number_base;

&Usage("Too few arguments") if $#ARGV<0;

GetOptions(

    'o|out_dir=s'    => \$output_dir,
    'b|base=i'     => \$number_base

)or &Usage("Wrong arguments");

sub Usage(){

    my($msg) = @_;

    print "\nUsage: perl CutBaseRead.pl -o out_fir/ -b 40
   
    $msg!

    Argument(s):    -out_dir|-o     -base|-b\n";

    exit(1);
}

1 comment:

  1. André você poderia começar a colocar uns comentários no seus post :D

    ReplyDelete