On Jul 21, 2005, at 17:21, Jan Eden wrote:
Hi,
I need to store a list of month names into a hash structure such that:
$self->{monate}->{1}->{bezeichnung} = 'Januar'
$self->{monate}->{2}->{bezeichnung} = 'Februar'
etc.
Until now, I have used the rather clumsy:
@month_hash{1..12} = ("Januar", "Februar", "März", "April", "Mai",
"Juni", "Juli", "August", "September", "Oktober", "November",
"Dezember");
for (sort keys %month_hash) { $self->{monate}->{$_}->{bezeichnung}
= $month_hash{$_}; }
Basically the same, only using an array for the months (which is more
natural for its use in that snippet, and avoids the "sort keys"), and
not using arrows in nested estructures, since they are optional and
the code is more readable without them:
my @months = qw(Januar Februar März April Mai Juni Juli August
September Oktober November Dezember);
$self->{monate}{$_}{bezeichnung} = $m[$_-1] for [EMAIL PROTECTED];
-- fxn
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>