#!/usr/bin/perl -w use strict; use Getopt::Std; use vars qw/ $opt_i $opt_o $opt_n $opt_s $opt_h /; my $inputFile; my $outFile = "Default.out"; my $n = 123; my $s; getopts( 'i:o:n:s:h' ); if( $opt_i ) { $inputFile = $opt_i; &usage( "Input File $inputFile does not exist" ) unless ( -T $inputFile ); } else { &usage( "Must specify output file with -i" ); } if( $opt_o ) { $outFile = $opt_o; } if( $opt_n ) { $n = $opt_n; } if( $opt_s ) { $s = $opt_s; } else { &usage( "Must specify s number with -s " ); } if( $opt_o ) { $outFile = $opt_o; } if( $opt_h ) { &usage(); exit; } print "Input file is $inputFile\n"; print "Output file is $outFile\n"; print "n is $n\n"; print "s is $s\n"; sub usage { my $msg = shift; print < -s -o[] -n[] USAGE exit; }