in reply to Re: Shift function and file opening
in thread Shift function and file opening

There's a tiny trap here, because not unly undef evaluates to a false value.
The values that evaluate to false are undef, 0, (), '0' (/me hopes he didn't forget one).
Try this:
perl -e "print (shift || 'foo.html');" 0 perl -e "print (shift || 'foo.html');" 1
daniel.

Replies are listed 'Best First'.
Re: Re: Re: Shift function and file opening
by edan (Curate) on Sep 04, 2003 at 13:33 UTC

    You forgot '' (the empty string), which also evaluates to false.

    --
    3dan