in reply to Re^3: Build your array with push
in thread Build your array with push

My problem with the second approach (apart from the "read only" snag) is that it turns constant data into something that requires computation. Certainly, there are times when computation is necessary with constant data, such as when you are constructing a data structure like an array of arrays: you take tab-separated data, split on the tabs, and produce array references. That's certainly easier and faster to write than producing the data structure in the code itself. But in this case, I think it was overkill.

Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart

Replies are listed 'Best First'.
Re^5: Build your array with push
by demerphq (Chancellor) on Jan 31, 2006 at 16:06 UTC

    Right, I can see your point. I think for me it would come down to a matter of whether run time issues are more important than development time issues. Generally I'd say that development time is more important so I'd probably go with whatever saved me the most work.

    ---
    $world=~s/war/peace/g