Anyone's free to assist Part 1 is already done just need assistance for part (2-4) See below provided test data aswell
1)Read in any number of name/value pairs, 2)Read in names in pairs of two, and compute their sum. 3)Choose the maximum of all those pairs and print it. 4)At the same time choose the minimum and print it. In the code below part 1) is done 1) testing input data: boris 1 bruce 2 john 3 output data : key = boris value = 1 key = bruce value =2 key = john value = 3 ------------------------------------------------------------------------------------------------------------------- 2) testing input data: boris 1 bruce 2 output data: sum = 3 ------------------------------------------------------------------------------------------------------------------- 3) output data :max_of_pairs = bruce 2 ------------------------------------------------------------------------------------------------------------------ 4) output data :min_of_pairs = boris value ------------------------------------------------------------------------------------------------------------------ use strict; my %nvp; #hash containing nae value pairs my $name; # key of the hash my $value; # value associated with the key $| = 1; print"Enter Name Value\n"; while (<STDIN>) { chomp; last unless $_; # end loop if STDIN had only a new line if (/([A-Za-z]+)\s(\d+)/) { # here names have only letters and name vale pairs are space delimited $name = $1; # captured alphabetic char fm above $value = $2; # captured digits fm above $nvp{$name} = $value; # $name and $value could be eliminated by using $1 $2 here... } else { # reject if not valid print "I don't see this a a valid name/value pair\n"; } } print"Sorted:\n\n"; foreach my $key (sort keys %nvp) { print"key = $key value = $nvp{$key}\n"; } print"Unsorted:\n\n"; foreach my $key (keys %nvp) { print"key = $key value = $nvp{$key}\n"; } ---------------------------------------------------------------------------------------------------------------------- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]