On Sat Nov 10 18:27:32 2012, lgodio2@gmail.com wrote:
Show quoted text> Shlomi,
>
> It still doesn't work... When I try to run :
>
> use Math::Cephes qw(:cmplx);
> my $a = new_cmplx(3, 5); my $b = new_cmplx(2, 3); my $c = new_cmplx();
> cdiv( $a, $b, $c );
> print $c->{r}, ' ', $c->{i};
>
> *I get this error message...*
>
> Can't locate object method "FETCH" via package "Math::Cephes::Complex" at
> C:\Perl\holdx.pl
Hi,
this works:
[QUOTE]
#!/usr/bin/perl
use strict;
use warnings;
use Math::Cephes qw(:cmplx);
use Math::Cephes::Complex;
my $x = new_cmplx(3, 5);
my $y = new_cmplx(2, 3);
my $z = new_cmplx();
cdiv( $x, $y, $z );
print $z->{r}, ' ', $z->{i}, "\n";
[/QUOTE]
With the use Math::Cephes::Complex. But you are right that it should
work without the explicit "use Math::Cephes::Complex;" statement.
Regarding the use of lexical $a and $b, see:
http://perl-begin.org/tutorials/bad-elements/#vars-a-and-b
Anyway, I'll get to fixing it.
Regards,
-- Shlomi Fish