Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

[PERL] What is this thing? [Beginner]

Name: Anonymous 2009-04-05 15:57

I am currently learning to program (Perl) and I've come across this:

$variable ||= 'stuff';

What does ||= mean?

Name: Anonymous 2009-04-05 16:04

It means vertically equal to.

Name: Anonymous 2009-04-05 16:06

It's the YHBT operator

Name: Anonymous 2009-04-05 16:07

>>2
I don't know if you're trolling me, but google turns up nothing.

Name: Anonymous 2009-04-05 16:08

$variable = $variable || 'stuff';

Like every other fucking combined operator/assignment.

Name: Anonymous 2009-04-05 16:09

>>4
You're stupid. What does || mean? What does = mean? Put one and one together.

Name: Anonymous 2009-04-05 16:10

>>5
Thanks. I did not know that. I'm new to this programming thing in general.

Name: Anonymous 2009-04-05 16:11

>>6
how || get formed
how variable get assigned

Name: Anonymous 2009-04-05 16:41

>>8
they need to do way instain operator

Name: Anonymous 2009-04-05 16:43

||= is the double guard operator. It ensures the nomads that the buffalo won't leave the designated hunting ground.

Name: Anonymous 2009-04-05 16:48

prime GET

Name: Anonymous 2009-04-05 16:58

>>11
Eleven isn't a prime number though. It's divisible by 11 and 1

Name: Anonymous 2009-04-05 17:15

>>12
0/10

you didn't even try.

Name: Anonymous 2009-04-05 17:33

>>12
I lol'd extensively.

Name: Anonymous 2009-04-05 17:36

>>1
perldoc perldoc
perldoc perl
perldoc perlop

Name: Anonymous 2009-04-05 18:57

>>13
Actually, 11 is divisible by 6.5 and 2, so it actually works out

Name: Anonymous 2009-04-05 19:11

>>16
facepalm

Name: Anonymous 2009-04-05 20:38

woah.
i would guess that it means assign 'stuff' to $variable if $variable is false

Name: Anonymous 2009-04-05 22:32

>>17
When you say a number is prime, you must specify the ring of integers you are working in.  For instance, 11 is not prime in Z[(1+√5)/2], the ring of integers of Q(√5), since 11=(4+√5)(4-√5).

Name: Anonymous 2009-04-05 22:36

>>19
That's a bunch of balogna. Whenever we talk about prime numbers, you have to assume it's the Natural Numbers (N) by default. That's how it's always worked for centuries.

Name: Anonymous 2009-04-05 22:41

>>18
But Perl has no boolean logic.

Name: Anonymous 2009-04-05 22:45

>>16
Prime numbers don't work that way you idiot. It's only with 2 and 3.

Name: Anonymous 2009-04-05 22:48

>>22
But 2 * 3 = 6, which is NOT a prime number?
Also, I take umbrage to your use of the derisive ``idiot'' remark, and I would ask you to apologize immediately.

Name: Anonymous 2009-04-05 22:52

I don't even know who is trolling anymore in this thread and I feel kind of bad about it :(

Name: Anonymous 2009-04-05 22:54

List of people who were not trolling in this thread:

Name: Anonymous 2009-04-06 0:18

>>25
My mother was not trolling in this thread last time I checked.

Name: Anonymous 2009-04-06 0:23

>>25
you should have made it so no one can post in this thread unless they admit that they trolled in this thread, like this:

List of people who were trolling in this thread:

Name: Anonymous 2009-04-06 0:29

>>27
IHBT

Name: Anonymous 2009-04-06 0:37

>>8-9
Ashamed to admit it, but I lol'd

Name: Anonymous 2009-04-06 0:43

>>29
Please familiarize yourself with the ‘sage’ function at your earliest convenience.

Name: Anonymous 2009-04-06 1:38

>>21
How does it determine the truth values of statements?

Name: Anonymous 2009-04-06 2:10

>>31
Great!

Name: Anonymous 2009-04-06 8:43

>>31
Statements don't have values; expressions do.

Name: Anonymous 2009-04-06 17:00

>>18
$variable = 'stuff' unless $variable has already been assigned.

In other words, if $variable does not have an assigned value, then it shall be assigned the value 'stuff'

Name: Anonymous 2009-08-16 17:02

Name: Anonymous 2010-12-20 17:36

Name: Anonymous 2011-02-04 15:23

Don't change these.
Name: Email:
Entire Thread Thread List