複素数を使う
Math::Complexモジュールを使うと簡単です。
use Math::Complex; my $y = 3 + 4*i; my $z = 10 + i; print $y + $z, "\n"; print $y - $z, "\n"; print $y * $z, "\n"; print $y / $z, "\n";
use Math::Complex; my $y = 3 + 4*i; my $z = 10 + i; print $y + $z, "\n"; print $y - $z, "\n"; print $y * $z, "\n"; print $y / $z, "\n";