|There's more than one way to do things|
Re: opening a file destroys nulling entries in a list?!?!by BrowserUk (Pope)
|on Aug 07, 2003 at 03:21 UTC||Need Help??|
I'm not surprised you are confused:) I get the same behaviour with AS 5.8.
This isn't a bug, and what's more
The problem lies with the while statement. Somehow, the aliasing of the input to $_ is getting mixd up with the first element of @_. This can be seen by printing the contents of the array just before the while and again inside it. Inside the loop, the first element of the array has been overwritten by the input from the diamond operator. At the end of the while loop, this then gets set to null. The original contents have been blown away!!
A work around is to explicitly localise $_ in the while as shown commented out above.
Examine what is said, not who speaks."Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
If I understand your problem, I can solve it! Of course, the same can be said for you.