All,
Hello,
First off, I have looked thru Learning Perl (3rd edition) and Perl in a Nutshell, but I did not find the answer to my question.
The best place to look for answers is the documentation that is supplied with Perl itself. A complete description of Perl's subroutines can be found by typing the following on your command line console/terminal:
perldoc perlsub
I know you can 'substitute' a subroutine name for a variable to get the result of the subroutine. My question is, can a subroutine return an array?
All of Perl's user defined subroutines return a list. See the perlsub document for details.
such as this:
...
sub lca { SQL Query }
while ( @lca) {
@lca is an array which is not related to the subroutine lca (unless @lca is a package variable, but you don't really need to know about that) and besides the while expression forces boolean (scalar) context *and* you are not storing what the subroutine returns so it will be lost. The perlsyn document has details on Perl's loop and branching syntax and the perldata document has details on Perl's data types.
perldoc perlsyn perldoc perldata
do stuff }
...
I am probably wrong on this. I am trying to avoid using a global
variable and keeping things on the smallest scope possible.
A very laudable goal.
John -- use Perl; program fulfillment
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>
