in reply to delete 'self' after running

If you want this script to run each time the machine boots another way would be to add it to the Windows registry. The key in question would be HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run. If you want the job to run once only then add it to the HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce key.

Further info on the registry keys in question is here. To manipulate the Registry via Perl see Win32::TieRegistry

Update: Added link to Microsoft docs and Win32::TieRegistry, and the Runonce registry key information

Hope this helps

Martin