in reply to How to vector

I have a feeling your problem may be in this code:

$aa->[0] = my $one; $aa->[1] = my $two; $aa->[2] = my $three;

You need to define these variables before assigning them, or you'll get the types of errors you're seeing. Are you sure it shouldn't be written like this instead?:

sub vector { my ($aa) = @_; my $one = $aa->[0]; my $two = $aa->[1]; my $three = $aa->[2]; my $vector = V($one, $two, $three); }

-stevieb

ps. I don't have any experience with that module, so I'm just guessing.

Replies are listed 'Best First'.
Re^2: How to vector
by jcklasseter (Sexton) on Jun 19, 2015 at 20:31 UTC
    It got something to print out at all. Positive step. A vector, according to the module, is similar to a blessed array reference. The exact output is
    The vector of Atom (0, 5, 5)is : %f {0, 5, 5} The vector of Atom (1, 2, 3)is : %f {1, 2, 3} The vector of Atom (3, 5, 6)is : %f {3, 5, 6} The vector of Atom (2, 5, 2)is : %f {2, 5, 2} The vector of Atom (5, 5, 5)is : %f {5, 5, 5} The vector of Atom (5, 5, 6)is : %f {5, 5, 6}
    Which is progress.

      The fact that  %f appears in the output stream suggests you are not using a printf (or sprintf) statement, and I don't know where the  {0, 5, 5} bits are coming from. Difficult to comment further.


      Give a man a fish:  <%-(-(-(-<