in reply to HoA create from array using map, more efficient?

Fyi, this:

($k,$v) = (split /\s+/,$_)[2,4];

is equivalent to:

my ($snap, $rotation) = (split)[2,4];

Also, use my() variables rather than global variables.

...which means you didn't use strict and warnings, which you should be doing too.

Replies are listed 'Best First'.
Re^2: HoA create from array using map, more efficient?
by ikegami (Patriarch) on Jun 18, 2011 at 20:23 UTC
    There is a difference between the two, but it doesn't matter here since there's never any leading whitespace.
Re^2: HoA create from array using map, more efficient?
by hsinclai (Deacon) on Jun 18, 2011 at 20:22 UTC
    Thanks, the implicit split is better... also, yes that script runs under strictures (I didn't show the whole script obviously) -- I just declared ($k,$v) globally because I use them in a bunch of other places - maybe that's a bad idea but they get overwritten each time, and values are coming back correctly.
    Maybe that's a bad idea no matter how short the script?

      Avoid the my is surely a premature optimisation that can only hurt you.