develooper Front page | perl.beginners | Postings from February 2002

HELP! : To write a script that reads numbers from STDIN andprint on STDOUT.

From:
Bruce Ambraal
Date:
February 7, 2002 09:02
Subject:
HELP! : To write a script that reads numbers from STDIN andprint on STDOUT.
Message ID:
sc62c7ee.016@cct.org.za
Hi ALL

Could  any one write some coding for the following problem.

In perl against Linx could someone help.
-------------------------------------------------------------------------------------------------------------------
I want to write a script that reads in four numbers from STDIN and add the first two together, and than adds the second 2 together.
The input format is a number on a line.(press enter after every number)
I also want to ompare the resulting two numbers with > or < and print the largest on STDOUT.

--------------------------------------------------------------------------------------------------------------------
I have a second part to the previous problem.

I now want to modify the script to read a name, and then the number
(again each on its own line)
To read four name/number pairs
To read two names from STDIN and add the associated numbers together.
Repeat this step.
Then to compare the resulting two numbers with
< or > and print the largest on STDOUT.

Thanks in advance

Bruce




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About