http://qs321.pair.com?node_id=1231626


in reply to Re: Rosetta Code Error or $n // 100
in thread Rosetta Code Error or $n // 100

Thanks. Either the code as posted on Rosetta has a typo // instead of || or I misread it. Once I realized that the // should be read as || it all made sense. Thanks again. Those replies were quicker than my thinking process. :(!

Replies are listed 'Best First'.
Re^3: Rosetta Code Error or $n // 100
by choroba (Cardinal) on Mar 24, 2019 at 21:15 UTC
    No. || and // are two distinct operators. The first one checks whether its first argument is true, the second one whether it's defined; if not, they return the second argument. The difference becomes apparent with defined false values like 0:
    choroba@still ~ $ perl -wE 'say 0 || 1' 1 choroba@still ~ $ perl -wE 'say 0 // 1' 0

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]