On 30 Oct 2007 at 9:31, Kevin Viel wrote:
> > -----Original Message-----
> > From: Kaushal Shriyan [mailto:[EMAIL PROTECTED] 
> > Sent: Monday, October 29, 2007 11:25 PM
> > To: beginners@perl.org
> > Subject: Re: Hash Variables
> > 
> > I am referring to perldoc perlintro
> > my %fruit_color = ("apple", "red", "banana", "yellow");
> > 
> > You can use whitespace and the "=>" operator to lay them out 
> > more nicely:
> > 
> >                my %fruit_color = (
> >                    apple  => "red",
> >                    banana => "yellow",
> >                );
> > 
> > I know to use the Fat Comma Operator, How can one use the 
> > whitespace to lay the Hash Key/Values Pair. Please explain me 
> > with the above example.
> 
> First, I must confess that I am unsure of the effect of not placing
> "apple" and "banana" in quotation marks (but this is the place to get
> opinions <g>).

In front of the fat coma if it looks like a word its automatically 
quoted. "Looks as a word" in this case includes -word.
 
> Taking the style from SAS macro calls, I might write: 
> 
> my %fruit_color = ( apple  => "red"
>                   , banana => "yellow"
>                   ,
>                   ) ;
> 
> The Llama book states that the last comma is "harmless, but
> convenient".  I might be inclined to avoid it (but I need to test it):
> 
> my %fruit_color = ( apple  => "red"
>                   , banana => "yellow"
>                   ) ;

Sure, you can use it, you can skip it, whichever works better for 
you. 
(I find this style ... erm ... strange, but that's your decision.)

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


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


Reply via email to