print "First value: ";
chomp ($value1=<STDIN>;
print "Second Value: ";
chomp ($value2=<STDIN>;
print "Operator: ";
chomp ($value3=<STDIN>;

print ($value1 $value3 $value2, "\n");

But that was malfaunctioning. Is there a way to put the STDIN for the
operator directly in the print line or do I always have to keep it that long
winded?

Oliver


use eval..

print "Enter a expression to calculate:\n";
$expression = <STDIN>;
chomp($expression);
print eval($expression), "\n";


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to