sub loop { my ($from, $to, $action) = @_; if ($to < $from) { return; } else { $action->($from); loop($from+1, $to, $action); } }