in reply to Two Questions on "my"
Much of the work you're trying to avoid is done anyway when the braces define a scope. Generally, the idea is to use scoping to get rid of knowledge where it's unneeded. I'd use the second form in question one because $foo is then undefined afterwards. Similarly for question two, get rid of the declaration outside the loop.
If you must, you can make the exterior declaration and then say ($key, $value) = returnsAnArray(); inside the loop. I think the loops would be better written as { my $i = 0; while ($i++ < $a_big_number) { ... }} rather than the C-style for loops you have. You could also say for (0..$a_big_number) { ... }, but that is no way to save memory.
After Compline,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Two Questions on "my"
by Somni (Friar) on May 22, 2004 at 23:13 UTC |