in reply to Re: Memory tip
in thread Memory tip

which means the scalar has lesser space than the array, I know join gets into a string different elements but I did not know that there is a difference in the size when we are talking contexts of scalar and lists...

Replies are listed 'Best First'.
Re^3: Memory tip
by jrsimmon (Hermit) on Jun 30, 2009 at 17:09 UTC
Re^3: Memory tip
by SuicideJunkie (Vicar) on Jun 30, 2009 at 18:08 UTC
    The scalar also contains less information, and the process is NOT generally reversible.
    It is quite easy to reduce the memory use when your algorithm is allowed to be lossy :)

    For example, consider my @array = (1, 5, "hello,world!", 3.1415);
    There is no way to restore the original array after doing a join ',',@array on it.
    "1,5,hello,world!,3.1415" could have been (1, 5, "hello,world!", 3.1415) or it could have been (1, 5, "hello", "world!", 3.1415).