Please help with following: Using a while loop I want to do the following: Read info in from STDIN Read in any number of name/value pairs, Read in names in pairs of two, and compute their sum. Choose the maximum of all those pairs and print it. At the same time choose the minimum and print it.
My code does not do what I want it to do: --------------------------------------------------------------------------- #!/usr/bin/perl -w my @NumberArray; my $ArrayIndex =-1; my $NumberFromConsole; while ($ArrayIndex < 3) { $NumberFromConsole = <STDIN>; chomp($NumberFromConsole); $ArrayIndex = $ArrayIndex + 1; $NumberArray[$ArrayIndex] = $NumberFromConsole; } my $FirstNumber = $NumberArray[0] + $NumberArray[1]; my $SecondNumber = $NumberArray[2] + $NumberArray[3]; print "The Number array is @NumberArray\nThe first two are $FirstNumber\nThe second two are $SecondNumber\n"; if ($FirstNumber > $SecondNumber) { print "The first number was bigger, "; print $FirstNumber; } elsif ($SecondNumber > $FirstNumber) { print "The second number was bigger, "; print $SecondNumber; } else { print "The numbers are equal."; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]