Think about Loose Coupling | |
PerlMonks |
Re: Storing variable coordinates in a matrixby Fletch (Bishop) |
on Mar 15, 2007 at 16:37 UTC ( [id://605016]=note: print w/replies, xml ) | Need Help?? |
Aside from a few extra parens, your problem is that you're storing the value in $x and $y as it is at the time @A is initialized. In order to get close to doing what you want you'd need to store references to $x and $y, but that won't let you store (say) $y+1 and you'd have an additional layer of dereferencing to get the values out. The best compromise would be to make a sub which returns a new set of coords given a new $x and $y.
In Section
Seekers of Perl Wisdom
|
|