sub routine string call
Probly easy answer but im looking for a way to call a sub out of a string into play after building it in the string dynamically. basically:
sub basesub {
...
return @somearray;
}
my secondsub {
my $str = "&basesub";
my @returnarray = $str;
print(@returnarray);
}
i cant for the life of me find the method to call the subroutine out of the str back into play as a true sub.
sub basesub {
...
return @somearray;
}
my secondsub {
my $str = "&basesub";
my @returnarray = $str;
print(@returnarray);
}
i cant for the life of me find the method to call the subroutine out of the str back into play as a true sub.
1
person has this question
I have this question, too!
Tell me when someone answers.
The more people who ask this question, the more it gets noticed.
The more people who ask this question, the more it gets noticed.
-
Inappropriate?Hi Construct,
You can 'evaluate' a string as though it were a program, ex.
my @returnarray = eval($str);
but this is a really bad practice and is to be avoided.
Regards,
Mace Bergmann
O'Reilly Media Inc.
http://www.oreilly.com
800-998-9938
Loading Profile...


