Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to make a script that if you type in - it does subtraction if i type in * it does multiplication so far I have
#!/usr/bin/perl print "What is your name?\n"; $name = <>; chomp($name); $greeting = "Hello, " . $name . "\nWhat do type of math do you want th +is program to do?\n"; print $greeting; print "What is the first number?\n"; $a = <>; chomp($a); print "What is the second number?\n"; $b = <>; chomp($b); print "Here is the answer\n"; $c = $a - $b; print $c; print "\nTada\n"; exit();
what need I add ?
Thank thee for thine wisdom
20031024 Edit by Corion: Added formatting
BazB: title changed as suggested.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help with simple calculator script.
by cchampion (Curate) on Oct 24, 2003 at 16:15 UTC | |
by sauoq (Abbot) on Oct 24, 2003 at 22:29 UTC | |
|
Re: Help with simple calculator script.
by pg (Canon) on Oct 24, 2003 at 16:07 UTC | |
by Anonymous Monk on Oct 24, 2003 at 20:21 UTC | |
by davido (Cardinal) on Oct 24, 2003 at 23:49 UTC | |
|
Re: Help with simple calculator script.
by monktim (Friar) on Oct 24, 2003 at 16:14 UTC | |
|
Re: Help with simple calculator script.
by hardburn (Abbot) on Oct 24, 2003 at 16:32 UTC | |
|
Re: Help with simple calculator script.
by kutsu (Priest) on Oct 24, 2003 at 16:15 UTC | |
|
Re: Help with simple calculator script.
by BUU (Prior) on Oct 24, 2003 at 16:10 UTC |