in reply to Populating a hash

"most efficient implementation?"

Most efficient by what measure?

Please clarify your question.

Replies are listed 'Best First'.
Re^2: Populating a hash
by Anonymous Monk on Mar 11, 2012 at 15:13 UTC

    what i had in mind was lower code lineage - being hopefully reflected in cpu utilization

      Anytime you have to preface a desired result with "hopefully," you have a wish, not a plan.

      Some suggestions for alternate coding are surely forthcoming ... but my suggestion is "benchmark;" don't just hope, know. Fewer lines does emphatically NOT  eq "faster" code or "lower cpu utilization." There's so much going on behind the green curtain (cf Wizard of Oz) that benchmarking or intimate familiarity with perlguts (which labels itself only as an "introduction" to the Perl API) and the deeper reaches of Perl wisdom and C will you be able to confidently predict any particular case.

      And not just BTW, it's my suspicion that Perl will usually do a better job of optomizing-away bits of my code than I will.

Re^2: Populating a hash
by ansh batra (Friar) on Mar 11, 2012 at 13:57 UTC
    ww: how can you change the stograge style of a data structure?
    and whenever it comes to efficiency, i dnt think that programmer effort is taken into picture.
    I have always taken efficiency as cpu and time consumption
      storage? any one of many compression techniques. Think '.zip' or RLE or bit vectors or ....

      efficiency? Your usual choices are usually valid, but would you consider them the best measure of the "efficiency" of producing a one-off or rarely used program? Being concerned solely with "cpu and timeUpdate1 consumption" and ignoring "programmer time" might be a serious case of premature optimization.

      Update 1: I assume from context that the "time" reference meant "run time."

      how can you change the stograge style of a data structure?
      use Storable
      i dnt think that programmer effort is taken into picture.
      I have always taken efficiency as cpu and time consumption
      programmer effort consumes time