in reply to Re: Use variable outside if statement
in thread Use variable outside if statement
Make it a global variable, don't use "my"
Ummm... Just a thought, aside from what diotalevi said, I don't think Perl would be happy with that solution since the original poster has Use Strict; in his code.
It's poor coding practice to unnecessarily declare such broad scopes when smaller scopes would be just as effective. I can't tell you how often I reuse variable names, making it even more important to limit their scope. Can you imagine the kind of bugs that would crop up if you use a global variable called $count in all your While loops?
----
Is it fair to stick a link to my site here?
Thanks for you patience.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Use variable outside if statement
by jryan (Vicar) on Dec 20, 2003 at 06:04 UTC |