From:                   [EMAIL PROTECTED]
> I don't know for sure the effect of:
> 
> @out_array_bin = map {""} (@out_array_bin);
> 
> instead of
> 
> for ($init_cnt=0;$init_cnt<=$#out_array_bin;$init_cnt++) {
>    $out_array_bin[$init_cnt] = "";
> }
> 
> But is more readable.

Neither makes much sense.
And the map based one is actually even more memory hungry. 

        @out_array_bin = ();
or 
        undef @out_array_bin;

will clear the array completely and will be much quicker.

The problem with the for(){} is that it doesn't get rid of the whole 
array, just the values of the elements. So you end up with a huge 
array containing empty strings. Which will take up quite some memory.

The map{} is even worse because instead of "clearing" the array "in 
place" it creates a new huge array containing the empty strings. So 
at one point you have two huge arrays. One containing the data and 
the other containnig the empty strings :-(

Jenda
=========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==========
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
                                        --- me


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to