Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > comma operator

Reply
Thread Tools

comma operator

 
 
Franken Sense
Guest
Posts: n/a
 
      05-15-2009

I'm reading up on perl today and find this in perldoc perlop:

Comma Operator

Binary "," is the comma operator. In scalar context it evaluates its
left argument, throws that value away, then evaluates its right
argument
and returns that value. This is just like C's comma operator.

// end excerpt

What is C's comma operator?
--
Frank

Whining is anger through a small opening.
~~ Al Franken
 
Reply With Quote
 
 
 
 
Franken Sense
Guest
Posts: n/a
 
      05-15-2009
In Dread Ink, the Grave Hand of Franken Sense Did Inscribe:

[misposted to clp.misc]
[x-posted to clc; f-up set to clc]
> I'm reading up on perl today and find this in perldoc perlop:
>
> Comma Operator
>
> Binary "," is the comma operator. In scalar context it evaluates its
> left argument, throws that value away, then evaluates its right
> argument
> and returns that value. This is just like C's comma operator.
>
> // end excerpt
>
> What is C's comma operator?



--
Frank

My father grew up in the Great Depression - his mother's.
~~ Al Franken
 
Reply With Quote
 
 
 
 
Andrew DeFaria
Guest
Posts: n/a
 
      05-15-2009
body { font: Helvetica, Arial, sans-serif; } p { font: Helvetica, Arial, sans-serif; } ..standout { font-family: verdana, arial, sans-serif; font-size: 12px; color: #993333; line-height: 13px; font-weight: bold; margin-bottom: 10px; } ..code { border-top: 1px solid #ddd; border-left: 1px solid #ddd; border-right: 2px solid #000; border-bottom: 2px solid #000; padding: 10px; margin-top: 5px; margin-left: 5%; margin-right: 5%; background: #ffffea; color: black; -moz-border-radius: 10px; } ..codedark { border-top: 10px solid #03f; border-left: 1px solid #ddd; border-right: 2px solid grey; border-bottom: 2px solid grey; padding: 10px; margin-top: 5px; margin-left: 5%; margin-right: 5%; background: black; color: yellow; -moz-border-radius: 10px; } #code { color: black; font-size: 14px; font-family: courier; padding-left: 5px; } #line-number { color: #804000; font-family: Arial; font-size: 14px; padding-right: 5px; border-right: 1px dotted #804000; } blockquote[type=cite] { padding: 0em .5em .5em .5em !important; border-right: 2px solid blue !important; border-left: 2px solid blue !important; } blockquote[type=cite] blockquote[type=cite] { border-right: 2px solid maroon !important; border-left: 2px solid maroon !important; } blockquote[type=cite] blockquote[type=cite] blockquote[type=cite] { border-right: 2px solid teal !important; border-left: 2px solid teal !important; } blockquote[type=cite] blockquote[type=cite] blockquote[type=cite] blockquote[type=cite] { border-right: 2px solid purple !important; border-left: 2px solid purple !important; } blockquote[type=cite] blockquote[type=cite] blockquote[type=cite] blockquote[type=cite] blockquote[type=cite] { border-right: 2px solid green !important; border-left: 2px solid green !important; } Franken Sense wrote:
I'm reading up on perl today and find this in perldoc perlop:

Comma Operator

Binary "," is the comma operator. In scalar context it evaluates its left argument, throws that value away, then evaluates its right argument and returns that value. This is just like C's comma operator.

// end excerpt

What is C's comma operator?
Hmmm... You bothered to "read up" on Perl today. Why did you not likewise "read up" on C? I mean a simple Google search of 0.0123 seconds of "c comma operator" gives the results you seek. And it probably would have taking 6.234 times less time than it took you to compose your post.


--
Andrew DeFaria
Can you buy anything specific at a general store?

 
Reply With Quote
 
Tad J McClellan
Guest
Posts: n/a
 
      05-15-2009
Franken Sense <(E-Mail Removed)> wrote:
>
> I'm reading up on perl today and find this in perldoc perlop:
>
> Comma Operator
>
> Binary "," is the comma operator. In scalar context it evaluates its
> left argument, throws that value away, then evaluates its right
> argument
> and returns that value. This is just like C's comma operator.
>
> // end excerpt
>
> What is C's comma operator?



It is an operator that evaluates its left argument, throws that value
away, then evaluates its right argument and returns that value.

It is just like Perl's comma operator.


--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
 
Reply With Quote
 
Franken Sense
Guest
Posts: n/a
 
      05-15-2009
In Dread Ink, the Grave Hand of Tad J McClellan Did Inscribe:

> Franken Sense <(E-Mail Removed)> wrote:
>>
>> I'm reading up on perl today and find this in perldoc perlop:
>>
>> Comma Operator
>>
>> Binary "," is the comma operator. In scalar context it evaluates its
>> left argument, throws that value away, then evaluates its right
>> argument
>> and returns that value. This is just like C's comma operator.
>>
>> // end excerpt
>>
>> What is C's comma operator?

>
>
> It is an operator that evaluates its left argument, throws that value
> away, then evaluates its right argument and returns that value.
>
> It is just like Perl's comma operator.


This is a footnote from n1336.pdf:

100) A comma operator does not yield an lvalue.

Is this also true in perl?
--
Frank

I think if you're going to do a movie about Reagan you do it about the fact
that he created the huge deficit, that he armed the mujahadeen, that he
armed Saddam, that he armed Iran, he armed 2/3s of the Axis of Evil, he
funded terrorists in Central America, he was in my mind a terrible
president.
~~ Al Franken, Book TV, on CBS's Reagan movie
 
Reply With Quote
 
RedGrittyBrick
Guest
Posts: n/a
 
      05-15-2009

Franken Sense wrote:
> In Dread Ink, the Grave Hand of Tad J McClellan Did Inscribe:
>
>> Franken Sense <(E-Mail Removed)> wrote:
>>>
>>> I'm reading up on perl today and find this in perldoc perlop:
>>>
>>> Comma Operator
>>>
>>> Binary "," is the comma operator. In scalar context it evaluates its
>>> left argument, throws that value away, then evaluates its right
>>> argument
>>> and returns that value. This is just like C's comma operator.
>>>
>>> // end excerpt
>>>
>>> What is C's comma operator?

>>
>> It is an operator that evaluates its left argument, throws that value
>> away, then evaluates its right argument and returns that value.
>>
>> It is just like Perl's comma operator.

>
> This is a footnote from n1336.pdf:
>
> 100) A comma operator does not yield an lvalue.
>
> Is this also true in perl?


C> perl -e "$x,$y = 42; print qq(x=$x, y=$y)"
x=, y=42

--
RGB
 
Reply With Quote
 
Uri Guttman
Guest
Posts: n/a
 
      05-15-2009
>>>>> "R" == RedGrittyBrick <(E-Mail Removed)> writes:

R> Franken Sense wrote:
>>
>> 100) A comma operator does not yield an lvalue.
>>
>> Is this also true in perl?


C> perl -e "$x,$y = 42; print qq(x=$x, y=$y)"
R> x=, y=42

there is no lvalue in that first statement. comma binds lower than = so
that was $x followed by $y = 42 which works. the problem is finding a
way to have a comma operator which binds tighter than =. using parens
won't work since that makes a list and it isn't a comma op anymore but a
list element separator.

and finally WTF is franken sense asking dumb sidebar questions and
getting answers. he needs to focus on learning perl and not obscure side
issues like comma ops and lvalues (i bet he doesn't even know what the term
lvalue means)

uri

--
Uri Guttman ------ http://www.velocityreviews.com/forums/(E-Mail Removed) -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
 
Reply With Quote
 
Tad J McClellan
Guest
Posts: n/a
 
      05-15-2009
Franken Sense <(E-Mail Removed)> wrote:

> **** off



So long potty mouth.


--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
 
Reply With Quote
 
Franken Sense
Guest
Posts: n/a
 
      05-15-2009
In Dread Ink, the Grave Hand of Uri Guttman Did Inscribe:

> and finally WTF is franken sense asking dumb sidebar questions and
> getting answers. he needs to focus on learning perl and not obscure side
> issues like comma ops and lvalues (i bet he doesn't even know what the term
> lvalue means)


**** off, Uri. I'll bet you're an asshole in every time zone.
--
Frank

When you encounter seemingly good advice that contradicts other seemingly
good advice, ignore them both.
~~ Al Franken,
 
Reply With Quote
 
Jürgen Exner
Guest
Posts: n/a
 
      05-16-2009
Franken Sense <(E-Mail Removed)> wrote:
>In Dread Ink, the Grave Hand of Uri Guttman Did Inscribe:
>
>> and finally WTF is franken sense asking dumb sidebar questions and
>> getting answers. he needs to focus on learning perl and not obscure side
>> issues like comma ops and lvalues (i bet he doesn't even know what the term
>> lvalue means)

>
>**** off, Uri. I'll bet you're an asshole in every time zone.


Your request for entry into the killfile has been approved.

jue
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
comma operator and assignment operator G Patel C Programming 4 02-08-2005 02:53 AM
the whys of the comma operator Michael Scarlett C Programming 8 06-19-2004 12:08 AM
Confused about the comma operator Derek C++ 6 04-13-2004 09:03 PM
Yet another comma operator question Koster C Programming 7 01-18-2004 01:07 AM
Overloading comma to give a concatenation operator: various problems Paul Davis C++ 7 07-17-2003 07:25 AM



Advertisments