Thread array im hash (30 answers)
Opened by Free Faq at 2004-03-12 21:27

pq
 2004-03-14 04:27
#80940 #80940
User since
2003-08-04
12208 Artikel
Admin1
[Homepage]
user image
[quote=esskar,13.03.2004, 22:02]
Code: (dl )
1
2
%hash = (a => 'A', b => 'B');
%hash = (%hash, c => 'C', d => 'D');
[/quote]
das kann bei sehr grossen hashes eventuell ungünstig sein, da hier der gesamte
inhalt umkopiert wird. alternativ kann man das hier machen:
Code: (dl )
1
2
my %neu = (b=>2,c=>3);
while (my ($k,$v) = each %neu) {$hash{$k} = $v}
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Damian Conway in "Perl Best Practices"
lesen: Wiki:Wie frage ich & perlintro Wiki:brian's Leitfaden für jedes Perl-Problem

View full thread array im hash