use v5.40.0; use experimental 'class'; class Gear { field $chainring :param :reader; field $cog :param :reader; field $rim :param :reader; field $tire :param :reader; method ratio { return $chainring/$cog; } method gear_inches { return ratio * $rim + ($tire * 2); } } say Gear->new(chainring=>52, cog=>11, rim=>26, tire=>1.5)->gear_inches;