in reply to Using a scalar as an array name
Update: I should re-emphasize that the above is BAD as in "don't cross the streams" -- I only posted it because it technically works and the OP insisted on knowing any kind of way to accomplish it.my @MyArray = ( 1, 2, 3, 4 ); my $varname = 'MyArray'; my $x = eval '$' . $varname . '[0]'; # THIS IS BAD!!!!! print $x; # 1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using a scalar as an array name
by Animator (Hermit) on May 15, 2005 at 22:34 UTC | |
by rvosa (Curate) on May 15, 2005 at 23:05 UTC |