use strict;
use Getopt::Std;

#ex>cmdopt -o [-q] -d{0|1|2} 文字列 [文字列 ...]

our( $opt_o, $opt_q, $opt_d );

getopts('oqd:');

die "oオプションが指定されていない\n" unless $opt_o;
die "dオプションが指定されていない\n" unless defined $opt_d;
die "dオプションの引数は0-2\n" unless ($opt_d eq '0' || $opt_d eq '1' || $opt_d eq '2');
die "パラメータが指定されていない\n" unless @ARGV;

print "[オプション情報]\n";
print "o(output): ON\n" if $opt_o; 
print "q(quote): " . ($opt_q ? "ON" : "OFF") . "\n"; 
print "d(debug): $opt_d\n";

print "\n[パラメータ情報]\n";
printf("指定数: %d\n", $#ARGV+1);

my $c = 0;
for my $arg (@ARGV){
	$c++;
	print "$c: $arg\n";
}

