You are looking at a very old, but free version of the course. If you are interesed the most recent version, check it out on the Perl Maven site.

5.15. Move external call into function

Example 5-24. examples/intro/t14_calc.t

use strict;
use warnings;

use Test::Simple "no_plan";

open my $fh, "<", "calc.txt" or die $!;

while ( my $line = <$fh> ) {
    chomp $line;
    next if $line =~ /^\s*(#.*)?$/;

    my ( $exp, $res ) = split /\s*=\s*/, $line;

    ok( mycalc($exp) == $res, $exp );

sub mycalc {
    return `./mycalc @_`;

See the mycalc() function.

We could have also implemented this in a module called Mycalc.
In that case we would just write use Mycalc; and test the exported function.

use MyCalc;
use Test::Simple tests => 1;
ok(mycalc('2 + 3') == 5);

If you are interested in on-site trainings by the author, please contact me directly.