in reply to Re: Using variables in array names
in thread Using variables in array names

Why the eval???
no strict 'refs'; my $point1 = 'valpt'; eval "\@use_$point1 = (1,2,3)"; print @use_valpt;
can be written as:
no strict 'refs'; my $point1 = 'valpt'; @{"use_$point1"} = (1,2,3); print @use_valpt;

Replies are listed 'Best First'.
Re^3: Using variables in array names
by polypompholyx (Chaplain) on Aug 05, 2005 at 14:29 UTC
    Because I am being particularly dim today. You're quite right: using eval is unnecessary, and may well be like handing a box of matches to a kid whose already playing with petrol. I shouldn't have mentioned it :)