That is exactly the same as:my %favs = ( syfy => 'Babylon 5', fantasy => 'Lord of the Rings', animated => 'Monsters vs. Aliens', anime => 'El Cazador de la Bruja', );
Which is the same as:my %favs = ( 'syfy', 'Babylon 5', 'fantasy', 'Lord of the Rings', 'animated', 'Monsters vs. Aliens', 'anime', 'El Cazador de la Bruja', );
So => is the same as a comma!! The only difference is that with => the operand on the left can be a bareword (i.e. does not normally have to be quoted). So that hash assignment is really just a list. And since perl is looking for key/value pairs the number of elements in the list has the be an even number.my %favs = ( 'syfy', 'Babylon 5', 'fantasy', 'Lord of the Rings','ani +mated', 'Monsters vs. Aliens', 'anime', 'El Cazador de la Bruja', );
Elda Taluta; Sarks Sark; Ark Arks
In reply to Re: Hash assignment "odd" ness
by Argel
in thread Hash assignment "odd" ness
by phigment
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |