in reply to delete 'self' after running

For item 2, you might fork a new process and delete the script like below
.... do something .... if (my $pid = fork()){ exit; } else { sleep 20; unlink file; exit; }

I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction

Replies are listed 'Best First'.
Re^2: delete 'self' after running
by Errto (Vicar) on Jun 14, 2007 at 14:17 UTC
    I haven't tested it but I am guessing this will not work on Win32. The reason is that fork on Win32 is emulated, meaning as far as the OS is concerned the original script is still running and cannot be unlinked.