perldoc -f atan2 atan2 Y,X Returns the arctangent of Y/X in the range -PI to PI. For the tangent operation, you may use the "Math::Trig::tan" function, or use the familiar relation: sub tan { sin($_[0]) / cos($_[0]) } #### bash-2.03$ cat ./atan2.pl #!/usr/local/bin/perl -w use strict; my $x = defined($_=shift) ? $_ : die "Enter X\n"; my $y = defined($_=shift) ? $_ : die "Enter Y\n"; my $r = atan2( $y, $x ); print "angle = $r radians\n"; bash-2.03$ ./atan2.pl 4 3 angle = 0.643501108793284 radians