in reply to Meaning of //

Other told you what it does, though the author attempted to do strange things.

Something or 1 is always true, so this

return 1 unless ($flag // 1)

will never happen.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

Replies are listed 'Best First'.
Re^2: Meaning of //
by pryrt (Abbot) on Oct 17, 2019 at 19:54 UTC
    Except when $flag is false.
    C:\usr\local\share\PassThru\perl>perl -le "print +1//55"
    1
    
    C:\usr\local\share\PassThru\perl>perl -le "print +undef//55"
    55
    
    C:\usr\local\share\PassThru\perl>perl -le "print +0//55"
    0
    
      > Except when $flag is false.

      You mean defined but false, but you are right, I was wrong.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery FootballPerl is like chess, only without the dice