Re: Understanding 'scope'



On 14 Feb 2004 17:53:37 -0800, Prab_kar@xxxxxxxxxxx (Prabh) wrote:

>Hello all,
>Is it possible to access a variable with local scope in a subroutine
>from outside of the subroutine?
>
Why yes, yes it is. As long as that subroutine accesses the globally
named variable and was called withing the scope of the local variable
declaration, and it was a global.

.



Relevant Pages

  • Re: Understanding scope
    ... > Is it possible to access a variable with local scope in a subroutine ... > sub testScope ... > It doesnt compile with 'use strict', after removing strict, I get ...
    (comp.lang.perl.misc)
  • Re: type/rank mismatch error
    ... | procedures that are *NOT* in the same scope as the USE statement. ... See host association. ... declaration overrides the host-associated declaration. ...
    (comp.lang.fortran)
  • Re: ASSOCIATE and CONTAINed sub-subprograms
    ... END SUBROUTINE Use_br ... declaration statement. ... Note that the internal procedure is ... scope only of constructs within the host subprogram. ...
    (comp.lang.fortran)
  • public declaration isnt visible inside an interface?
    ... "dp" isn't visible within the interface's subroutine declarations. ... subroutine mxCopyPtrToComplex16 ... end module mexf90 ... Can someone explain why the declaration for "dp" doesn't ...
    (comp.lang.fortran)
  • Re: perldocs (etc) on recursion in Perl? Dont understand _WCPS_ example
    ... PL> 2) You want to call the subroutine without using parentheses ... prototyped sub, the compiler had to compile a declared prototype so it ... inside the sub for a declaration as it happens too late. ... declaration was required simply because of recursion. ...
    (comp.lang.perl.misc)