Follow-up Comment #7, bug #68793 (group groff):

[comment #4 comment #4:]

> my $TMPDIR=exists($ENV{TMPDIR})?$ENV{TMPDIR}:'.';


> This is perl's ternary operator - test ? value if true : value if
> false. So $TMPDIR is set to $ENV{TMPDIR} if it exists else '.'.

For environment variables, I use this simpler syntax to accomplish the above:

$TMPDIR = $ENV{TMPDIR} // '.';

The // operator tests for definedness rather than existence, but I don't know
of a way a value of @ENV might be undef (unless the Perl code itself sets it
so), so it effectively works out to the same test.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?68793>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to