Sven: Array leeren - warum geht's nicht?

Beitrag lesen

Hello,

=================================

%bla = ("a","text", "b","text", "c","text");

print "vorher:\n";
while (($a, $b) = each(%bla)) {  print "$a => $b\n"; }

map("undef", %bla);

print "\nnachher:\n";
while (($a, $b) = each(%bla)) {  print "$a => $b\n"; }

=================================

Ausgabe:

vorher:
c => text
a => text
b => text

nachher:
c => text
a => text
b => text

Mit "delete" kommt genau das gleiche. Was ich jedoch gerne hätte, wäre ein geleertes Array. D.h. sowas:

vorher:
c => text
a => text
b => text

nachher:
c =>
a =>
b =>

Warum geht map() nicht? Was muss ich hier machen?

Gruß,

Sven