Thread Variable als subname: Subroutine funzt ned (7 answers)
Opened by dyspro at 2007-04-10 00:26

Froschpopo
 2007-04-10 13:04
#75776 #75776
User since
2003-08-15
2653 Artikel
BenutzerIn
[default_avatar]
ich würds vorher wenigstens mit exists verifizieren:
Code: (dl )
1
2
3
4
5
6
7
8
9
my %subrefs = (
name => \&func
);

if (exists $subrefs{$var}) {
&{$subrefs{$var}};
} else {
print "Funktion existiert nicht\n";
}

View full thread Variable als subname: Subroutine funzt ned