The error occurs in the module, but the coding error is actually located in your calling program. When you do this:
my @vector = (4.3125, 0.4375);
push @AoA, @vector;
@vector = (4.375, 0.375);
push @AoA, @vector;
you are not creating an array of arrays (AoA), but a simple array whose 4 elements are:
(4.3125, 0.4375, 4.375, 0.375)
You need to push
on @AoA a reference to @vector:
my @vector = (4.3125, 0.4375);
push @AoA, \@vector;
@vector = (4.375, 0.375);
push @AoA, \@vector;
or build directly an array reference:
push @AoA, [4.3125, 0.4375];
push @AoA, [4.375, 0.375];
I guess this should solve your issue.
As I said earlier, you should avoid using the $a and $b variables, they are special variables used among other things for sorting, they behave differently from other variables, and using as you do them might lead to difficult-to-track bugs. You may use $c or $d, if you like, this will not be a problem, but I would personally put a more meaningful name helping comprehension of what they represent.
Update: As pointed below by farang the first method above for building an AoA is actually buggy. Use the second one. Thanks to farang for picking that.