in reply to Inputing an Operator is it possible?

First off, you can't have your <STDIN> in double-quotes. That will, quite literally, assign the characters

<STDIN>
to all of your variables.

What you can do is use a conditional statement to check for the operator that the user puts in. Something generic like the following will work. Of course, you'll have to work out the mojo behind each condition.

#!/usr/bin/perl -w print "First Number: "; $a = <>; # <> is short for <STDIN> print "Second Number: "; $b = <>; print "Operator: "; $operator = <>; if ( $operator == "+" ) { # Do some addition } elsif ( $operator == "-" ) { # Do some subtraction } elsif ( $operator == "/" ) { # Division } elsif { $operator == "*" ) { # Multiply } else { # Catch everything else print "DON'T YOU KNOW MATH?!?!\nMONKIES CAN DO MATH!!!\n"; }

And there you have it. CS 101, Assignment 1.



If you make something idiot-proof, eventually someone will make a better idiot.
I am that better idiot.