Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: ||= (poorly documented?)

by Anonymous Monk
on Jul 09, 2012 at 06:21 UTC ( #980655=note: print w/ replies, xml ) Need Help??


in reply to ||= (poorly documented?)

This is really poorly documented...

Yes, if you only go by perldoc.perl.org/perlop.html, looking only for |=", it is poorly documented.


Comment on Re: ||= (poorly documented?)
Re^2: ||= (poorly documented?)
by frozenwithjoy (Curate) on Jul 09, 2012 at 06:31 UTC
    To be fair, some things are a pain in the ass to google properly (especially if you aren't familiar with the topic in the first place). Also, documentation always makes more sense when you already know the topic. :P
      This actually is easily googleable... if you're deep enough into the Perl culture. Try searching for it under the name "orcish maneuver", which will explain not only what the operator is but also exactly how it's being used in this case. (Link is to duckduckgo's first result, which just happens to also be on PerlMonks.)

      Also note that, because of the distinction between truthiness and definedness mentioned in previous replies, you're going to want to use //= instead of ||= in the vast majority of cases unless your code needs to support pre-5.10 versions of Perl.

        If you are "deep enough in the Perl culture" to know to google "orcish maneuver", you probably don't need to look it up. On the other hand, if all you know to google is "||=", you're screwed unless you think to try "double pipe equals".
      To be fair ...

      Teach a man how to find answers and you teach him for life.
      Answer his questions for him and you get Perlmonks XP.

        You got me, the only reason I'm on here is to accumulate XP so I can get more spells and a larger HP pool next level.

        Seriously though, I think the OP did a decent job trying to figure things out before posting. S/he read the obvious doc, did some troubleshooting, and had a nearly correct understanding of the ||= operator, but was unsure and needed confirmation and a little guidance. I think the OP's main issue is that the reader of perlop needs to extrapolate some of the function of ||= from the examples for += and the OP may have missed that. Regarding // vs ||, even some of the people answering had some confusion.

        OK, that's my two cents. Now I'm off to Reddit, where the votes actually matter!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (14)
As of 2014-12-26 17:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (174 votes), past polls