HaB has asked for the wisdom of the Perl Monks concerning the following question:
Is this redundant? Wouldn't my() be better suited to do this? I'm not sure why he even wants local copies of those vars, since they never change. I guess what I'm looking for is a practical explanation of the difference between my and local, and the situations in which you would prefer one over the other. I have strict in use all the time, but I have only ever used my(), so I'm not clear on the difference.# at the top of the script: $sb="\013"; $eb="\034"; # those two values are never altered anywhere else in the main portion + of the script. # then, later... sub whatever { local ($sb); local ($eb); $sb="\013"; $eb="\034"; # rest of sub }
|
---|
Replies are listed 'Best First'. | |
---|---|
(Ovid) Re: my and local differences
by Ovid (Cardinal) on Nov 10, 2000 at 23:11 UTC | |
by HaB (Sexton) on Nov 10, 2000 at 23:29 UTC | |
Re: my and local differences
by redcloud (Parson) on Nov 10, 2000 at 23:10 UTC | |
by Fastolfe (Vicar) on Nov 10, 2000 at 23:20 UTC | |
Re: my and local differences
by btrott (Parson) on Nov 10, 2000 at 23:35 UTC | |
RE: my and local differences
by lemming (Priest) on Nov 10, 2000 at 23:17 UTC | |
by HaB (Sexton) on Nov 10, 2000 at 23:33 UTC | |
RE: my and local differences
by quidity (Pilgrim) on Nov 11, 2000 at 00:20 UTC |