in reply to Re: Can this code be optimized further?
in thread Can this code be optimized further?

eval qq{\$arrays{ "$_" } = \\\@$_} for qw( a b ); ?!?!?

Am I the only one that thinks unncessary evals are just ugly? While I commend you for trying to keep the surrounding code unchanged (by creating @a and @b), I think the better solution is to improve the surrounding code by making sure the appropriate data structures are used - in this case, a HoA is appropriate.

Being right, does not endow the right to be rude; politeness costs nothing.
Being unknowing, is not the same as being stupid.
Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

Replies are listed 'Best First'.
Re^3: Can this code be optimized further?
by Fletch (Bishop) on Feb 10, 2005 at 14:26 UTC

    If you can think of a better way to get a reference to an arbitrary lexical without eval sure. The original question was how to get things into arrays @a and @b; this gets things into the lexical arrays.

    Granted they may really need a HoA to begin with, but this technique (or the equivalent $arrays{ $_ } = do { no strict 'refs'; \@{ $_ } } for a package variable) sometimes is useful.