B. Fongo <[EMAIL PROTECTED]> wrote:
:
: I get the usual warning "Use of uninitialized ." while trying
: to test a variable ($counter) which is initialized later in
: my script.
Well that would make sense. The if statement below assumes
a value is in $counter. In perl undefined and 0 are both false.
: Using the pragma use vars ($counter) makes it sticky.
1. Don't use this unless you are trying to create a global.
2. Don't use globals.
: To avoid, I tried to work around it by passing it to a sub.
:
: my $counter = counter();
:
: if ($counter == 0){
I don't know what you intend to accomplish with the
subroutine. Why not tell us what you want to do and we'll
help you get there.
HTH,
Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>