open(FILE,">>",$dieFile); my $value = somecommand or die FILE "$!\n"; close(FILE);