#!/usr/bin/perl -w use strict; while(<>) { chomp; # # Stop if the user typed 'exit'. # last if /^exit$/; # # Call subroutines parse_line() and calculate() to do the actual work # my($op, $n1, $n2) = parse_line($_); my $result = calculate($op, $n1, $n2); # # Print the results. # print "$n1 $op $n2 = $result\n"; } # # Now all you have to do is write parse_line() and calculate() so that # the program will work! #