in reply to Perly way of handling coordinates?

One way to do it is to write a class and overload '+' (untested):

package Coord; use overload '+' => \&add; sub new { my ($class, $x, $y) = @_; return bless { x => $x, y => $y}, $class; } sub add { my ($self, $other) = @_; return Coord->new($self->{x} + $other->{x}, $self->{y} + $other->{y}); }

Of course this code is missing all kinds of sanity checks. You might even consider to bless an array ref instead of a hash ref, but then it's much harder to extend.