On Sun, Jun 14, 2009 at 11:59, Tech W.<tech...@yahoo.com.cn> wrote:
> --- On Sat, 13/6/09, John W. Krahn <jwkr...@shaw.ca> wrote:
>>     When you say
>>
>>         $scalar = (2, 5, 7, 9);
>>
>>     you’re using the comma operator in scalar
>> context, so it uses the
>>     scalar comma operator.
>
> Here, what is the "scalar comma operator"?
> I can't understand for that. Thanks.
snip

from perldoc perlop (or http://perldoc.perl.org/perlop.html#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.

       In list context, it’s just the list argument separator, and inserts
       both its arguments into the list.  These arguments are also evaluated
       from left to right.

The first of these two paragraphs describes the behaviour of the comma
operator in scalar context.  The second paragraph describes the
behaviour in list context.

-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to