[EMAIL PROTECTED] wrote:
In a large program, I guess there may be many programmers involved
and each of these programmers are responsible to write their own sub
rountine as required. Henceforth it will be very confusing and
problematic if the programmers have to use variables from outside of
t
- Original Message -
From: "Gunnar Hjalmarsson" <[EMAIL PROTECTED]>
To:
Sent: Thursday, March 27, 2008 8:27 AM
Subject: Re: question on lexical declaration and submodule
...
but I dont think this is a good idea as the sub-module will then have a
mixture of both
[EMAIL PROTECTED] wrote:
> Hi,
>
> I am doing some studies on sub modules and Lexical variables (my).
>
> With regards to diagram 1 below, what can I do so that the lexical $counter can count up to 4.
>
> Of course, one way of doing this is to change the lexical $counter into a global variabl
Rob Dixon wrote:
The way I would write that is to lessen the scope of $counter by
declaring it immediately before the subroutine that uses it:
use strict;
use warnings;
my $anything = 0;
while ($anything < 5){
$anything +=1;
testing_module() ;
}
my $counter = 0;
sub testing_module {
[EMAIL PROTECTED] wrote:
> Hi,
>
> I am doing some studies on sub modules and Lexical variables (my).
>
> With regards to diagram 1 below, what can I do so that the lexical $counter
> can count up to 4.
>
> Of course, one way of doing this is to change the lexical $counter into a
> global vari
[EMAIL PROTECTED] wrote:
I am doing some studies on sub modules and Lexical variables (my).
What you call "sub modules" are usually called "subroutines" (or,
sometimes, "functions").
With regards to diagram 1 below, what can I do so that the lexical
$counter can count up to 4.
Of course,