Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re^2: ||= (poorly documented?)

by frozenwithjoy (Priest)
on Jul 09, 2012 at 06:31 UTC ( #980658=note: print w/replies, xml ) Need Help??

in reply to Re: ||= (poorly documented?)
in thread ||= (poorly documented?)

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

Replies are listed 'Best First'.
Re^3: ||= (poorly documented?)
by dsheroh (Prior) on Jul 09, 2012 at 09:15 UTC
    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".
Re^3: ||= (poorly documented?)
by Anonymous Monk on Jul 09, 2012 at 14:56 UTC
    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!

Re^3: ||= (poorly documented?) (on truthiness)
by Anonymous Monk on Jul 09, 2012 at 22:10 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://980658]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2018-03-20 08:29 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (248 votes). Check out past polls.