in reply to strict and variable scopes
in thread strict problem
There may be a semantics problem here, too. One of the reasons that my was introduced to perl to was to give perl true local variabls, as local was a work around using a technique of substituting globals. What you would be telling perl is "please make this a local variable, but then don't be strict with me and let me use it anywhere I want without chiding me" (I hope that doesn't sound too harsh!). If you really want global variables, you probably want to use what perl terms as "package" variables:
Instead of using my, you would declare the package that you are in (probably just "main" in this case) like so:Hope that helps. By the way, there are all kinds of nodes here discussing local, my, our etc., and how various monks deal with scoping. Best of luck!
$main::in = ...
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: strict and variable scopes
by Anonymous Monk on Mar 20, 2002 at 18:17 UTC | |
by chromatic (Archbishop) on Mar 20, 2002 at 21:07 UTC |