[PERL] What is this thing? [Beginner]
1
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?
2
Name:
Anonymous
2009-04-05 16:04
It means vertically equal to .
3
Name:
Anonymous
2009-04-05 16:06
It's the YHBT operator
4
Name:
Anonymous
2009-04-05 16:07
>>2
I don't know if you're trolling me, but google turns up nothing.
5
Name:
Anonymous
2009-04-05 16:08
$variable = $variable || 'stuff';
Like every other fucking combined operator/assignment.
6
Name:
Anonymous
2009-04-05 16:09
>>4
You're stupid. What does
|| mean? What does
= mean? Put one and one together.
7
Name:
Anonymous
2009-04-05 16:10
>>5
Thanks. I did not know that. I'm new to this programming thing
in general .
8
Name:
Anonymous
2009-04-05 16:11
>>6
how || get formed
how variable get assigned
9
Name:
Anonymous
2009-04-05 16:41
>>8
they need to do way instain operator
10
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.
11
Name:
Anonymous
2009-04-05 16:48
prime GET
12
Name:
Anonymous
2009-04-05 16:58
>>11
Eleven isn't a prime number though. It's divisible by 11 and 1
13
Name:
Anonymous
2009-04-05 17:15
>>12
0/10
you didn't even try.
14
Name:
Anonymous
2009-04-05 17:33
>>12
I lol'd extensively.
15
Name:
Anonymous
2009-04-05 17:36
>>1
perldoc perldoc
perldoc perl
perldoc perlop
16
Name:
Anonymous
2009-04-05 18:57
>>13
Actually, 11 is divisible by 6.5 and 2, so it actually works out
17
Name:
Anonymous
2009-04-05 19:11
18
Name:
Anonymous
2009-04-05 20:38
woah.
i would guess that it means assign 'stuff' to $variable if $variable is false
19
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).
20
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.
21
Name:
Anonymous
2009-04-05 22:41
>>18
But Perl has no boolean logic.
22
Name:
Anonymous
2009-04-05 22:45
>>16
Prime numbers don't work that way you idiot. It's only with 2 and 3.
23
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.
24
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 :(
25
Name:
Anonymous
2009-04-05 22:54
List of people who were not trolling in this thread:
26
Name:
Anonymous
2009-04-06 0:18
>>25
My mother was not trolling in this thread last time I checked.
27
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:
28
Name:
Anonymous
2009-04-06 0:29
29
Name:
Anonymous
2009-04-06 0:37
>>8-9
Ashamed to admit it, but I lol'd
30
Name:
Anonymous
2009-04-06 0:43
>>29
Please familiarize yourself with the ‘sage’ function at your earliest convenience.
31
Name:
Anonymous
2009-04-06 1:38
>>21
How does it determine the truth values of statements?
32
Name:
Anonymous
2009-04-06 2:10
33
Name:
Anonymous
2009-04-06 8:43
>>31
Statements don't have values; expressions do.
34
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'
35
Name:
Anonymous
2009-08-16 17:02
38
Name:
Anonymous
2010-12-20 17:36
39
Name:
Anonymous
2011-02-04 15:23