On Wed, Aug 3, 2011 at 2:32 AM, terry peng <terry.p...@mail.ru> wrote:

> I have forgot that, is there a //= operator in Perl?
> which should do the same stuff as:
>
> unless (defined($foo) ) {
>    $foo = ...;
> }
>
> Thanks.
>
>
Yes.

Now wasn't that simple? : ) It's the defined-or, and you can read more about
it on perlop[0]. Do be mindful that in ancient versions of Perl it's not
available; If for whatever reason you are on one of those.. Please update?

[0] http://perldoc.perl.org/perlop.html#C-style-Logical-Defined-Or

Reply via email to