Perl;
print { open my $out, ">", "pidfile"; $out or die } $$, "\n";
Ruby;
File.open('pidfile', 'w+'){ |fh| fh.puts Process.pid }
I could have used ‘$$’ instead of Process.pid, but I prefer readability
PHP;
file_put_contents( 'pidfile', getmypid() );
Yeah I know, I know but anyway…




