#!/usr/bin/perl

use strict;


main();


sub main {


    #prompt the user for a numbner, save the # to a variable, removed the newline
    print "Please enter the first number: ";
    my $first_num = <STDIN>;
    chomp($first_num);

    #prompt for + / - /
    print "please enter \'+ / * -\'";
    my $oper = <STDIN>;
    chomp($oper);

    #prompt for second number
    print "Please enter the second number: ";
    my $second_num = <STDIN>;
    chomp($second_num);

    #initialize a scalar which is null to hold the results
    my $res;

    
    #check what operator was passed, and execute.  save the results to $res
    ##!! if the operator is not handled, exit with an error
    if ($oper eq "+") {
	$res = $first_num + $second_num;
    } elsif ($oper eq "-") {
	$res = $first_num - $second_num;

    } elsif ($oper eq "*") {
	$res = $first_num * $second_num;

    } elsif ($oper eq "/") {
	$res = $first_num / $second_num;

    } else {
	die("ERROR:  Invalid operator specified!!\n");
    }
    
    print "\n\tYour result is:  $res\n\n";

    

}

