Re: [PATCH RFC3.5 05/12] send-email: Improve redability and error-handling in send_message's sendmail code
- From
Michael Witten <mfwitten@gmail.com>
- Date
- Apr 19, 2009, 02:13 UTC
- Message-ID
- <b4087cc50904181913g117937le333c3b255f7d184@mail.gmail.com>
- In-Reply-To
- <76718490904181851g2701ce59x614ea60452b914ce@mail.gmail.com>
On Sat, Apr 18, 2009 at 20:51, Jay Soffian <jaysoffian@gmail.com> wrote:
> What is '//' about?
It's called the Logical Defined-OR:
http://perldoc.perl.org/perlop.html#C-style-Logical-Defined-Or
> Although it has no direct equivalent in C, Perl's // operator is related to its C-style or. In fact, it's exactly the same as ||, except that it tests the left hand side's definedness instead of its truth. Thus, $a // $b is similar to defined($a) || $b (except that it returns the value of $a rather than the value of defined($a)) and is exactly equivalent to defined($a) ? $a : $b . This is very useful for providing default values for variables. If you actually want to test if at least one of $a and $b is defined, use defined($a // $b) ...
However, I wonder if your comment is a veiled quip at my "Improve redability" claim (which is also ironically unreadable). :-)