On May 28, 1:53 am, [EMAIL PROTECTED] (Jeevs) wrote:
> my %hash = (jeevan=>'Ingale', Sarika =>'Bere');
> my @star = @hash{jeevan, Sarika};
> print @star;
>
> this prints ingale and bere but when i write
>
> my %hash = (jeevan=>'Ingake', Sarika =>'Bere');
> my @star = %hash{jeevan, Sarika};
> print @star;
>
> its an error..
>
> Can someone explain or atleast point me to any document explainng what
> exactly happens heres...

perldoc perldata

     Entire arrays (and slices of arrays and hashes) are denoted
     by '@', which works much like the word "these" or "those"
     does in English, in that it indicates multiple values are
     expected.

         @days               # ($days[0], $days[1],... $days[n])
         @days[3,4,5]        # same as ($days[3],$days[4],$days[5])
         @days{'a','c'}      # same as ($days{'a'},$days{'c'})

     Entire hashes are denoted by '%':

         %days               # (key1, val1, key2, val2 ...)


Basically, you can't just make s*** up and expect it to work.
Whatever gave you the idea that '%hash{jeevan, Sarika}'  was legal
syntax?

Paul Lalli


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


Reply via email to