On Oct 29, 8:25 pm, [EMAIL PROTECTED] (Kaushal Shriyan) wrote:
> Hi
>
> 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.
>
> Thanks and Regards
>
> Kaushal
>
> On 10/29/07, Kaushal Shriyan <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi,
>
> > I have a sample code
>
> > ########################################################
>
> > #!/usr/bin/perl -w
>
> > %states = ( "California","Sacramento", "Wisconsin","Madison", "New York",
> > "Albany");
>
> > print "Capital of California is " . $states{"California"} . "\n\n";
>
> > ########################################################
>
> > I did not understand the statement $states{"California"} in the above
> > print statement of the code
>
> > I know the the dot is a concatenation operator and \n is a newline
> > character
>
> > Thanks in Advance.
>
> > Thanks and Regards
>
> > Kaushal

#!/usr/bin/perl

use warnings;
use strict;
use Data::Dumper;

my %fruit_color = qw(apple red banana yellow);
print Dumper \%fruit_color;


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


Reply via email to