Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
As the title states, this is my very first attempt at Obfuscation/JAPH so please don't be gentle with your comments. I had fun creating this and would love to hear constructive criticism that I can apply to my next attempt.

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;

In reply to First timer... by Nitrox

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-04-25 13:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found