#!/usr/local/bin/perl -w
use strict ;
use Switch ;
use constant PI => 3.141592653589793 ;
use constant HALFPI => ( PI / 2.0 ) ; # half
use constant TWOPI => ( 2.0 * PI ) ; # double
print TWOPI."\n";
print HALFPI."\n";
# directory is '/home'''''''''
my $long = 4.567 ; # radians
my $convention = 'W' ;
switch ( $convention ) {
case ('E') { print "east longitude $long radians\n"; }
case ('W') { $long = TWOPI-$long ; print "west longitude $long radians\n"; }
else { print "error: $convention not valid\n"; }
};
####
% monks_help.pl
syntax error at monks_help.pl line 11, near ") {"
Execution of monks_help.pl aborted due to compilation errors.
##
##
use constant HALFPI => ( PI / 2.0 ) ;
to
use constant HALFPI => { 0.5 * PI } ;
##
##
use constant TWOPI => ( 2.0 * PI ) ;
to
use constant TWOPI => ( PI / 0.5 ) ;