in reply to Memory tip

I don't think you understand what you've observed. In your example, you are using join to turn the array (1,2,3,4) into the scalar "1,2,3,4".

Replies are listed 'Best First'.
Re^2: Memory tip
by biohisham (Priest) on Jun 30, 2009 at 16:38 UTC
    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...
      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).