Ok,

I went to google and did some more searching, this time just about the
my var.

I wrote this for an example of BAD use of $variable based on the
article I found.

I believe this demonstrates the coding in my website currently online.
lol, which is failing periodically.

---------------------------------------------------------------
my $i = 1;
my $variable;

if($i > 0)
{
  $variable = "Hello World!";
  print_it();
}

sub print_it()
{
  print "$variable<br>";
  $variable=1;
}


{
  my $variable = "True";
  print "$variable<br>";
}

print "$variable<br>";
---------------------------------------------------------------

When I run it for the first time I get

Hello World!
True
1

Every time after that I get

1
True
Hello World!

Until the process dies and it runs in a new thread.

I believe this is the demonstration of my problem right? I'm pretty
sure I understand now.

Thanks for the tips mate! I'll post this as my fix in the forum.
Tony

[EMAIL PROTECTED] wrote:


Thank you for the response.

I am sure going to start using strict.

But one thing, why doesn't my example of NOT using strict, my, our, or local ever fail.

Shouldn't it confuse the $html var with the value of the $html var in the parent file.

Any ideas on what kind of an example will demonstrate to me the variable problem I'm having in a small test program. I'm trying to make a program that will show the effects of not using strict and declaring the $vars. I want to be able to get it to mess up, and then declare the $vars and see it work differently.

I am trying to do this because I do not understand how the $vars are treated differently when not declared.

Thanks a lot!
Tony

Boysenberry Payne wrote:

It might be that your variable aren't scoped properly.
Try:

use strict;

my $variable
or
our $variable
to keep the variable scoped to the packages they're in.


Boysenberry

This message contains information that is confidential
and proprietary to Humaniteque and / or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.

http://www.habitatlife.com
The World's Best Site Builder
On Aug 10, 2005, at 11:57 AM, [EMAIL PROTECTED] wrote:


Hello Everyone,

I have an issue that I am working on. I always ask questions that I have to a forum before writing the list just in case someone in the forum knows the answer. Usually I don't get any responses.

I started this thread,

http://www.tek-tips.com/viewthread.cfm?qid=1104388&page=1

Will someone take a look and see if my last question can be answered. The first two posts will provide context for my situation. My handle is perl21

I was following some advice from a fellow named Fish.

In my last post in that thread I ask how to make my mod_perl script mess up the variable assignment of $html without using my or local

Thank you,
Tony









Reply via email to