Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^3: Rosetta Code Error or $n // 100

by choroba (Bishop)
on Mar 24, 2019 at 21:15 UTC ( #1231627=note: print w/replies, xml ) Need Help??


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

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]

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1231627]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2019-11-12 09:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (64 votes). Check out past polls.

    Notices?