On Feb 20, 2004, at 9:20 PM, [EMAIL PROTECTED] wrote:

They're different operators. => is the same thing as the comma. It's sole
difference is readability.

That's the reason we use it, but it's not the only difference. See below.


For example

%hash = ( key => "value",
                key2 => "value2",
               );
#is the same as
%hash = ( key, "value",
                key2,"value2",
               );

Not quite. You have to quote key and key2 in the second hash. That leads us to the advantage of =>. It automatically quotes the left operand, if it looks like a simple hash key. Handy, eh?


James


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to