in reply to Re^2: strange list operator
in thread [Resolved] strange list operator

List assignment is not optimized, but for is.
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^4: strange list operator
by xiaoyafeng (Deacon) on Oct 09, 2015 at 08:51 UTC
    Thanks for your reply, but does perl put all list assignments together? otherwise you can't explain why it still throw out of memory when example 2running




    I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction

      That's because you used literals, so the range operator is expanded at compile time. If you used
      my $max = 2e7; my @aa = 1 .. $max; my @bb = 1 .. $max;

      You'd get no error, as the lists are expanded at runtime and immediately thrown away.

      لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
        Thanks!! your replies perfectly answer my question. I can't still believe perl list assignment has the flaw/bug like this though. I will use list assignment at runtime at most.




        I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction