B
Bill H
This has always vexed me. When trying to access an array in the
following manner it never works and I end up assigning a variable. Can
someone point me to some docs on what I am doing wrong?
Example to show the issue, not my real code:
for($i = 0;$i < 4;$i++)
{
$temp = substr("0000".$i,-4);
$in{'VALUE$i'} = $i; # This never works
}
The $in{'VALUE$i'} never works, I have tried a number of different
ways:
$in{"VALUE$i"}
$in{"VALUE".$i}
ect
The only thing that seems to work is:
$a = "VALUE$i";
$in{$a} = $i;
But this can be cumbersome when I have a lot of variables I am trying
to set. I am sure there is some simple perl way of doing this, I just
have never found it yet.
Bill H
following manner it never works and I end up assigning a variable. Can
someone point me to some docs on what I am doing wrong?
Example to show the issue, not my real code:
for($i = 0;$i < 4;$i++)
{
$temp = substr("0000".$i,-4);
$in{'VALUE$i'} = $i; # This never works
}
The $in{'VALUE$i'} never works, I have tried a number of different
ways:
$in{"VALUE$i"}
$in{"VALUE".$i}
ect
The only thing that seems to work is:
$a = "VALUE$i";
$in{$a} = $i;
But this can be cumbersome when I have a lot of variables I am trying
to set. I am sure there is some simple perl way of doing this, I just
have never found it yet.
Bill H