Is it possible to reference a specific array element? For instance:
my @array = (21..102); my $ref = \$array[5]; $$ref = 4; print $array[5];
Essentially I want to be able to pass this reference to an element of the array to a sub for editing. Or more precicely, I want to go through the array one element at a time and pass one argument at a time to another function for modification. Any idea how I would go about this? Is it even allowed? While I do use normal refs on a regular basis, this is something I'm clueless for... so any help would be appreciated, down to a technical explanation of how they do referencing in perl. (I'm curious but I lack the skill in other languages to actually understand how perl itself was written... hehe)
Thank you for any assistance or advice as to other ways I could achieve this.
Note: I actually did try the equivilant of the above... yielded things like \45 instead of a reference...
My code doesn't have bugs, it just develops random features.
Flame ~ Lead Programmer: GMS (DOWN) | GMS (DOWN)
In reply to reference to array element? by Flame
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |