Thanks... I guess I was just doing something stupid.  My data was in a single column, so I tried this...Thanks... I guess I was just doing something stupid.  My data was in a single column, so I tried this...
use Math::Complex;

 

my @array = qw(

1+i
-1+i
-1-i
1-i
3
3*i
-3
-3*i
1+2*i
2+i
-1+2*i

.

.

.


And, it doesn't work with the qw or without the qw.  Without the qw I got zillions of errors, with the qw the Re portion was the whole thing and the there were no imaginary portions.  I guess the complex constructor would not be called if the array element is considered to be a string...

So, I just change the delimiter for my data from a new line to a comma-space, like you have, and it now works...

use strict;
use warnings;

use Math::Complex;

my @list = (1+i, -1+i, -1-i, 1-i, 3, 3*i, -3, -3*i, 1+2*i, 2+i, -1+2*i, -2+i, -2-i, -1-2*i, 1-2*i, 2-i, 7, 7*i, -7, -7*i, 11, 11*i, -11, -11*i, 2+3*i, 3+2*i, -2+3*i, -3+2*i, -2-3*i, -3-2*i, 2-3*i, 3-2*i, 1+4*i, 4+i, -1+4*i, -4+i, -1-4*i, -4-i, 1-4*i, 4-i, 19, 19*i, -19, -19*i, 23, 23*i, -23, -23*i, 2+5*i, 5+2*i, -2+5*i, -5+2*i, -2-5*i, -5-2*i, 2-5*i, 5-2*i, 31, 31*i, -31, -31*i, 1+6*i, 6+i, -1+6*i, -6+i, -1-6*i, -6-i, 1-6*i, 6-i, 4+5*i, 5+4*i, -4+5*i, -5+4*i, -4-5*i, -5-4*i, 4-5*i, 5-4*i, 43, 43*i, -43, -43*i, 47, 47*i, -47, -47*i);

print "List: @list\n";

foreach (@list) {
print "$_\t-> re=", Re( $_ ), ", im=", Im( $_ ), "\n";
}


Thanks all of you for the help.
I noticed that some of you are using Perl 6... I think 'say' is Perl 6?  I'm using Perl 5 with Padre on DWIM Perl on Windows.  My experience with Perl on Windows is difficult...  Active Perl is a pain because so many of the Perl modules that I want can't be had, or cost a lot of money for a subscription.  And Strawberry Perl's a pain when someone who's NOT a Perl Monk has to figure out how to use a module that you've downloaded from CPAN.  So, DWIM Perl is easier for some of these things, and it comes with Padre.  However, it's Perl 5... is there a relatively easy way a NON-Perl Monk can upgrade the Perl that DWIM Perl and Padre are using to Perl 6?
Thanks again, Paul


In reply to Re^2: array of complex numbers by pmccarthy
in thread array of complex numbers by pmccarthy

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.