in reply to Re: What does the short circuit || mean ?
in thread What does the short circuit || mean ?

Thanks choroba for explaining that.

It's like saying if $part->contentType is undefined, $ct will default to a value of "text/plain"

Replies are listed 'Best First'.
Re^3: What does the short circuit || mean ?
by AnomalousMonk (Archbishop) on Mar 10, 2015 at 01:22 UTC
    ... if $part->contentType is undefined ...

    This is a little tricky, but to be precise, you're saying "if $part->contentType is false", then do something. In Perl, falsity is represented by any of: undef (the undefined value), "" (the empty string), 0 (numeric zero), or '0' (a string consisting of a single 0 character). Use the  // operator to test specifically for defined-ness.

    Update: See also True and False (aka Booleans).


    Give a man a fish:  <%-(-(-(-<

      Thanks AnomalousMonk, that is a great guide for understanding true or false.