Hi, the following code tests number of arguments (4,
none, or anything else) and then it is intended to
take more input from command line (LINE1 and LINE2).
It works fine when no arguments (XXX.pl), but when 4
arguments (XXX.pl a b c d) are given, it does not stop
at LINE1 and LINE2 for input. Very wierd. 

Any idea will be appreciated.

Young
***********************************************
if ($#ARGV == 3){
        $file1 = $ARGV[0];
        $file2 = $ARGV[1];
        $out1 = $ARGV[2];
        $out2 = $ARGV[3];
}
elsif ($#ARGV == -1){
        print "Type in the name of the first file to compare:
";
        $file1 = <>;

        print "Type in the name of the second file to
compare: ";
        $file2 = <>;

        print "The name of the first output file. ";
        $out1 = <>;

        print "The name of the second output file. ";
        $out2 = <>;
}

else{
        print "USAGE: hglgpath-cross.pl input1 input2 output1
output2 OR just type hmlgpath-cross.pl.\n";
        exit;
};

open (IN1, "<$file1") || die ("Cannot open file:
$file1. Check the file name.\n");
open (IN2, "<$file2") || die ("Cannot open file:
$file2. Check the file name.\n");
open (OUT1, ">$out1") || die ("Cannot open file:
$out1. Disk may be full.\n");
open (OUT2, ">$out2") || die ("Cannot open file:
$out2. Disk may be full.\n");

#Get the field number in file 1 to be compared.
print "The field number you want to compare in file 1
(1,2,...n): ";
LINE1: $number1 = <>;
$targetfield1 = $number1 - 1;

#Get the field number in file 2 to be compared.
print "The field number you want to compare in file 2
(1,2,...n): ";
LINE2: $number2 = <>;
$targetfield2 = $number2 - 1;
****************************************************

__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/

---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
         [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
         [EMAIL PROTECTED]

Reply via email to