use v5.24; use warnings; my %hash = ( sub { my $key = shift; return $key, sub { say "Sub 1: Calling '$key' with @_"; } }->('ein komplexer Schlüssel'), sub { my $key = shift; return $key, sub { say "Sub 2: Calling '$key' with @_"; } }->('noch ein komplexer Schlüssel'), sub { my $key = shift; return $key, sub { say "Sub 3: Calling '$key' with @_"; } }->('dritter komplexer Schlüssel'), ); my ($letter1, $letter2) = ('A', 100); for my $key ( keys %hash ) { say "calling sub for '$key'"; $hash{$key}->($letter1++, $letter2--); say ''; }