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");
definitely would make more sense to use an array here, since you're
indexing via numeric value.
@months = qw(Januar Februar März April Mai Juni Juli August September
Oktober November Dezember);
for (sort keys %month_hash) { $self->{monate}->{$_}->{bezeichnung} =
$month_hash{$_}; }
and
$self->{monate}{$_}{bezeichnung} = $months[$_ - 1] for 1..12;
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>