my %data = ( mins_from_midnight('07:01') => 82, mins_from_midnight('23:48') => 188, # ... ); my $approx = Math::Approx->new(undef, 3, %data); print $approx->approx(mins_from_midnight('15:40'));