Geezer alert!

From looking at my old files (am I a packrat?) it appears that I learned perl on December 22, 1994. My first program was a log file analyzer for our web server. In August of 1994 I visited just about every web site that I could access. The best search engine for this task back then was called 'A Ton of Web Sites' and was a nearly comprehensive linear list of every web server that could be found.

I have used Perl ever since, and I've attended most of the Perl Conferences (now called OSCON).

My first widely-used CGI-type program was from 1995. It used MAILTO and procmail instead of GET or POST. This allowed reliable form submission even if the web server was down, which was not so uncommon back then. This system tracked hardware modifications in our prototypes. Users would submit forms through a MAILTO link. Mailing the form entries would cause procmail to run a perl program that then edited the HTML files, making the site dynamic. This system ran for years without a hitch, and I think some form of it may still be in use.

I think that I had learned perl3 and used it once some years before then, but had forgotten it.

I first admired perl in this usenet posting to comp.sources.games, which included both the C versions and perl versions of a program to compute pi. Here is the perl version:

eval "exec nice -19 perl $0 $*" if $running_under_some_shell; # -------------------------------------------------------------------- +------- # pi.perl computes pi (3.14...) about 5120 Digits # # W. Kebsch, July-1988 {uunet!mcvax}!unido!nixpbe!kebsch $my_name = `basename $0`; chop($my_name); $version = $my_name . "-1.2"; # some working parameter $smax = 5120; # max digits $lmax = 4; # digits per one array element $hmax = 10000; # one array element contains: 0..9999 $smin = $lmax; # min digits $mag = 7; # magic number # subroutines sub mul_tm # multiply the tm array with a long value { $cb = pop(@_); # elements(array) $x = pop(@_); # value $c = 0; for($i = 1; $i <= $cb; $i++) { $z = $tm[$i] * $x + $c; $c = int($z / $hmax); $tm[$i] = $z - $c * $hmax; } } sub mul_pm # multiply the pm array with a long value { $cb = pop(@_); # elements(array) $x = pop(@_); # value $c = 0; for($i = 1; $i <= $cb; $i++) { $z = $pm[$i] * $x + $c; $c = int($z / $hmax); $pm[$i] = $z - $c * $hmax; } } sub divide # divide the tm array by a long value { $cb = pop(@_); # elements(array) $x = pop(@_); # value $c = 0; for($i = $cb; $i >= 1; $i--) { $z = $tm[$i] + $c; $q = int($z / $x); $tm[$i] = $q; $c = ($z - $q * $x) * $hmax; } } sub add # add tm array to pm array { $cb = pop(@_); # elements(array) $c = 0; for($i = 1; $i <= $cb; $i++) { $z = $pm[$i] + $tm[$i] + $c; if($z >= $hmax) { $pm[$i] = $z - $hmax; $c = 1; } else { $pm[$i] = $z; $c = 0; } } } $m0 = 0; $m1 = 0; $m2 = 0; sub check_xb # reduce current no. of elements (speed up!) { $cb = pop(@_); # current no. of elements if(($pm[$cb] == $m0) && ($pm[$cb - 1] == $m1) && ($pm[$cb - 2] == $ +m2)) { $cb--; } $m0 = $pm[$cb]; $m1 = $pm[$cb - 1]; $m2 = $pm[$cb - 2]; $cb; } sub display # show the result { $cb = pop(@_); # elements(array); printf("\n%3d.", $pm[$cb]); $j = $mag - $lmax; for($i = $cb - 1; $i >= $j; $i--) { printf(" %04d", $pm[$i]); } print "\n"; } sub the_job # let's do the job { $s = pop(@_); # no. of digits $s = int(($s + $lmax - 1) / $lmax) * $lmax; $b = int($s / $lmax) + $mag - $lmax; $xb = $b; $t = int($s * 5 / 3); for($i = 1; $i <= $b; $i++) # init arrays { $pm[$i] = 0; $tm[$i] = 0; } $pm[$b - 1] = $hmax / 2; $tm[$b - 1] = $hmax / 2; printf("digits:%5d, terms:%5d, elements:%5d\n", $s, $t, $b); for($n = 1; $n <= $t; $n++) { printf("\r\t\t\t term:%5d", $n); if($n < 200) { do mul_tm((4 * ($n * $n - $n) + 1), $xb); } else { do mul_tm((2 * $n - 1), $xb); do mul_tm((2 * $n - 1), $xb); } if($n < 100) { do divide(($n * (16 * $n + 8)), $xb); } else { do divide((8 * $n), $xb); do divide((2 * $n + 1), $xb); } do add($xb); if($xb > $mag) { $xb = do check_xb($xb); } } do mul_pm(6, $b); do display($b); ($user,$sys,$cuser,$csys) = times; printf("\n[u=%g s=%g cu=%g cs=%g]\n",$user, $sys, $cuser, $csys) +; } # main block --------------------------------------------------------- +------- $no_of_args = $#ARGV + 1; print("$version, "); die("usage: $my_name <no. of digits>") unless($no_of_args == 1); $digits = int($ARGV[0]); die("no. of digits out of range [$smin\..$smax]") unless(($digits >= $smin) && ($digits <= $s +max)); do the_job($digits); exit 0; # That's all --------------------------------------------------------- +-------
It should work perfectly the first time! - toma

In reply to Re: 18 years old? by toma
in thread 18 years old? by traveler

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.