#!/usr/bin/perl -w
use strict;
my ($a, $b, $oper);

print "Enter the first number: ";

while (<>) {
  $a=$_; chomp($a);
  print "Enter the second number: ";
  $b=<>; chomp($b);
  print "Enter 1 to add, 2 to subtract: ";
  $oper=<>; chomp($oper);
  if ($oper == "1") {
    print "The sum is: " . ($a + $b) . "\n";
  } else {
    print "The difference is: " . ($a - $b) . "\n";
  }

print "Enter the first number: ";
}
