Well, there you have the reason!
It is not necessary to always ask "why" when someone asks a simple question.
I use scheduled job like the above to reboot the router during the night after I have downloaded a new version during the day.
I always have a scheduled job like this:
/system scheduler add name="scheduled reboot" on-event="/system reboot" policy=\ ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \ start-date=nov/19/2021 start-time=03:03:03
then after I download a new version I set the start-date to the next day, and voila, update during service interval without having to stay awake.
Now about doing such things via telnet. I think it is not wise to blindly send commands over telnet. When doing such things I always use the Unix tool "expect" that allows you to chat with a remote device reading the displayed prompts and answering with the desired reply.
That also allows you to handle exceptions like timeouts or other prompts (e.g. when doing this on some other devices, before the reboot the device may prompt if you want to save unsaved configuration, and you can reply to that only in cases when this prompt actually appears).
It looks like that Perl library has some support for such things in the login() function, but not as generic as expect.