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

dyspro
 2007-04-10 00:26
#75770 #75770
User since
2007-03-20
3 Artikel
BenutzerIn
[default_avatar]
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4 sub main {
5 my $eingabe = readline<STDIN>;
6 &$eingabe;
7 }
8 sub hello {
9 print "hi";
10 }
11 &main;


Das is mein code nur wenn ich den ausführen will und hello eingebe kommt folgende meldung:

readline() on unopened filehandle hello
Use of uninitialized value in subroutine entry at fut.pl line 6.
Can't use string ("") as a subroutine ref while "strict refs" in use at fut.pl line 6.


das ist nur in bispiel code. den richtigen code will ich nich veröffntlichen nur mir gehts ums prinzip das ich durchs eingeben von sachen eine subroutine ohne viele if und elsif's aufrufen will und das ist für mich die einzigste möglichkeit

View full thread Variable als subname: Subroutine funzt ned