2009/3/4 Avishalom Shalit <[email protected]>:
> also, i don't agree that the hash makes the code look weird.
>> my %beatles = (
>>    John => 'guitar',
>>    Paul => 'bass',
>>    George => 'sitar',
>>    Ringo => 'drums',
>> );
>
>> my %beatles ;
>>$beatles{$_}='x' for  qw/john paul george ringo/;

It works, but *sometimes* the code maintainer will wonder what this
"x" stands for. (A comment saying that it's just a dummy will solve
this.)

But all in all, the hash solution is quite elegant.

-- 
Amir Elisha Aharoni

heb: http://haharoni.wordpress.com | eng: http://aharoni.wordpress.com
cat: http://aprenent.wordpress.com | rus: http://amire80.livejournal.com

"We're living in pieces,
 I want to live in peace." - T. Moore
_______________________________________________
Perl mailing list
[email protected]
http://perl.org.il/mailman/listinfo/perl

Reply via email to