in reply to Solving a maths problem with Perl

And yes, I'm aware it can be solved without object-oriented programming.

use v5.16; package Local::App2 { use List::Util 'sum'; use Exporter::Shiny 'S'; sub a { my $n = shift; 1 + (1/$n); } sub S { my $n = shift; sum( map a($_), 1 .. $n ); } } use Local::App2 'S'; say S(15);

I like using OOP though because of the ease with which parts can be overridden, like in the rational number version.