Powered by Ajaxy
Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Perl: How to get the absolute value

#!/usr/local/bin/perl
$s = -1;
print "The absolute value of $s = ", abs $s;

Perl: How to convert value to degree

#!/usr/local/bin/perl
use strict;
my $y = 1.15470053837925;
my $x = 2.0;
my $conversion = 180 / 3.1415926535897932384626433832795;
print "The angle =

Perl: How to create complex number

use Math::Complex;
my $x = Math::Complex->new(3,5);    
my $y = Math::Complex->new(2,-2);
$z = $x * $y;
print "z = $zn";

Perl: How to alarm

 #!/usr/local/bin/perl
 eval
 {
while(<>) {
    print "Enter text...";
    alarm(10);
}
  }