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.


In reply to Re^5: enumerating values for slopes by Laurent_R
in thread enumerating values for slopes by Aldebaran

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.