Thread Gibt es einen Trick bei dem ein hash value seinen hash key kennt? (4 answers)
Opened by barney at 2025-07-04 14:43

barney
 2025-07-04 17:33
#197096 #197096
User since
2008-08-31
198 Artikel
BenutzerIn
[Homepage] [default_avatar]
Oder mit `do`:

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use v5.24;
use warnings;

my %hash = (
do {
my $key = 'AAA';
$key,
sub {
say $key;
};
},
do {
my $key = 'BBB';
$key,
sub {
say $key;
};
},
);

$hash{'AAA'}->();
$hash{'BBB'}->();

View full thread Gibt es einen Trick bei dem ein hash value seinen hash key kennt?