The program below has two functions:
1) If passed an integer (that represents a depth in feet) from the command line it will calculate the Atmospheres Absolute(ATA) for that depth (sea water is assumed).
2) If run without a parameter the program functions as a JAPH should.
This has been tested with v5.8 on Win32 and v5.6.1 on Linux.
-Nitrox
use strict;use warnings;use constant SCUBA => 33;my( $SCUBA_TANK,$SCUBA,$SCUBA_,%SCUBA,@SCUBA,$DIVE,$S);sub merge{ $SCUBA_TANK=$_[-1]}$SIG{__WARN__}=sub{merge($_[-1])},$S.=$S, $SCUBA_TANK=~/(\d+)/,$S=sub{foreach(reverse@_){ $SCUBA[$1*2].=substr($SCUBA[$1],$_+10,1)} $SCUBA[$1*2]};map{$DIVE.=chr(hex($_)+SCUBA)if($_)}reverse split /(..)/ +,"51444A4240"; $SCUBA[0]="Atmospheres Absolute";$SCUBA{TANK}=$1*2; $SCUBA=submerge()||&merge_;sub submerge{ $SCUBA_++if$ARGV[0];return$ARGV[0]||undef}if( $SCUBA_){$SCUBA=sprintf("\nDepth: %d(fsw) = %.2f $SCUBA[0](ATA)\n\n",$ +ARGV[$#ARGV],(++( $SCUBA/=33)))}sub merge_{$SCUBA[$1]=$SCUBA[-1], $SCUBA[$1]=~y,mb,nJ,,&$S(2,1,8,4,7,3),&$S(-22,-23,-24,-29,-27,-28),($_ +)=$^X=~/(\w{4})(\..*)?$/,s/^(.)/\u$1/; $SCUBA[$SCUBA{TANK}].=" $_ H".$DIVE}print $SCUBA;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: First timer...
by dingus (Friar) on Nov 26, 2002 at 08:37 UTC | |
by Nitrox (Chaplain) on Nov 26, 2002 at 12:42 UTC |