in reply to Re: Subroutine Return Values
in thread Subroutine Return Values

This is either a nit, or ignorance, but...

using AS 5.8.8 (819) on Win XP (gack, but no *n*x allowed at work), the last variant script in siva_kumar 's otherwise well-considered reply HANGS (as the knowledgable may well have expected).

It appears that his word "program" refers to ls (which was replaced with dir for this win test) but that the statement "Here ls command will get executed but $var will have nothing." would be more precise if rephased to:

"Here the ls command will be executed, but will never return control to the script. Hence, the line to print $var will never be executed."

From perldoc perlfunc: The "exec" function executes a system command *and never returns*-- use "system" instead of "exec" if you want it to return.

Replies are listed 'Best First'.
Re^3: Subroutine Return Values
by siva kumar (Pilgrim) on Jan 18, 2007 at 07:19 UTC
    Yes I agree. Thanks for comment.