Because in the first statement @array is used in scalar context so it's like you wrote 
something as
[EMAIL PROTECTED];
print $size."\n";

That's why you get the number of items contained in @array which is 3.

HTH,

José.

-----Original Message-----
From: Peter [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 24, 2003 6:13 AM
To: [EMAIL PROTECTED]
Subject: context, printing, and concatenation


I'm on the first few chapters of "Learning Perl" and came up with a question. Given:

-------------------------------------

@array = qw ( one two three );
print @array . "\n";
print @array;

-------------------------------------

Why does the first print statement print "3" (and a carriage return) while the second 
prints "onetwothree"?  I'm guessing that the first print sees the array in scalar 
context while the second sees it in list context, but if so I don't understand why.  
Can someone break it down what the concatenation operator is doing here?

Thanks.

-- 
"You can't waste a life hating people, because all they do is live their life, 
laughing, doing more evil."
 -- Alpha Robertson, whose daughter was killed in a Birmingham church  bombing in 
1963. 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



**** DISCLAIMER ****

"This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer".

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to