gyre007 has asked for the wisdom of the Perl Monks concerning the following question:
I mean if THE VERY SAME CODE WORKS FOR 'T' OPTION why DOES IT NOT WORK for 'O' option ?#!/usr/bin/perl -w use strict; use Getopt::Long; use Getopt::Std; #ArrayS of hashes my @MainFields = (); my @ReservedINFO = (); my $output_type; my $outputFile; our($opt_h, $opt_c, $opt_t, $opt_o); getopts('hc:t:o:'); # Reading specified options and calling particular initialization func +tions sub Init { my $file1; my $file2; my $tmp; if(defined($opt_h)){ print Syntax(); exit; } if(!defined($opt_t)){ print "\n***** Specify the type of the output! *****\n"; print Syntax(); exit; } $output_type = $opt_t; $file1 = $ARGV[0]; $file2 = $ARGV[1]; if((!defined($file1)) || (!defined($file2))){ print "\n***** Specify the INPUT files! *****\n"; print Syntax(); exit; } print "\nFirst file - $file1\nSecond File - $file2\n"; if(!defined($opt_c)){ print "\nNo config file provided, defualt configuration will be us +ed!\n"; init_default_config($output_type); } else { read_config_file($output_type); } if(!defined($opt_o)){ print "\n***** Specify name of the output file! *****\n"; print Syntax(); exit; } $outputFile = $opt_o;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: handling scripts options
by Fletch (Bishop) on Oct 15, 2008 at 12:39 UTC | |
|
Re: handling scripts options
by dreadpiratepeter (Priest) on Oct 15, 2008 at 12:37 UTC |