in reply to Re: Populate variables with values
in thread Populate variables with values
You might be wanting an array of references to the variables, however, in which case you just prefix each of the variable names with a '\' symbol in the list you're assigning to @VARIABLES.
To save some typing you can take a reference to the list of variables instead of to each variable in the list.
$ perl -Mstrict -wle ' > my $val1 = 99; > my $val2 = 77; > print $val1; > print $val2; > my @vars = \ ( $val1, $val2 ); > ${ $vars[ 0 ] } = 55; > ${ $vars[ 1 ] } = 33; > print $val1; > print $val2;' 99 77 55 33 $
I hope this is of interest.
Cheers,
JohnGG
|
|---|