[ Create a new account ]
A: print { open my $out, ">", "pidfile"; $out or die } $$, "\n";
Yes, I like Perl.
Why not a more traditional form?
print { open my $out, ">", "pidfile" or die "$!"; $out } $$, "\n";
But yeah, that is nifty.
Get More Comments
Reply
Odd construction (Score:1)
Why not a more traditional form?
But yeah, that is nifty.
Simpler and Sweeter (Score:1)
use File::Slurp
write_file( 'pid_file', "$$\n" )