in reply to Array How to/Performance: mass initialization or update using array slice

So close:)

@array[0..3] = (1000) x 4;

A little explanation:

Slices (whether array or hash) always start with the '@' sigil. See perldata search for "Slices".

x is the perl repetition operator. See perlop Search for "Multiplicative Operators".


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


  • Comment on Re: Array How to/Performance: mass initialization or update using array slice
  • Download Code