... sub logcroak { Carp::croak(@_); } ... open(FILE, ">$file") || logcroak "can't create $file: $!"; ...