[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Omaha.pm] Proper way to test a variable with strict and -w?




On Sep 2, 2005, at 11:37 AM, Daniel Linder wrote:
>Could be- what does “// “ do?

I believe someone mentioned that it is a "smarter" form of "||" that is due to be included in a future release of Perl.  In this example, if the value to the left of "//" is a value, zero or empty string, then the value the "//" operator returns will be the value/zero/empty string respectively.  If the variable is not defined (or possibly "NaN" or other error values), then it will return the value on the right side of the "//" operator.

I haven't seen a writeup of this new functions planned implementation rules so this might be way off.

http://www.perl.com/pub/a/2004/03/18/synopsis3.html

"Binary // is just like ||, except that it tests its left side for definedness instead of truth. There is a low-precedence form, too: err."

j