Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Perl subroutine libraries?

12 views
Skip to first unread message

Jennifer Freeman

unread,
Sep 25, 1990, 10:21:22 AM9/25/90
to

I have just starting messing around with perl, and was wondering if there
are any archive sites that might have some subroutines for things such
of Day of Week, or formatting print output for printout out dollars and cents
etc., things to study and help prevent having to reinvent the wheel at the
same time.

Don McMillan CS 50

unread,
Sep 25, 1990, 12:28:10 PM9/25/90
to

In article <11...@bsu-cs.bsu.edu>, jenn...@bsu-cs.bsu.edu (Jennifer

Likewise.... Sounds like a great idea!!
Anybody have anything to contribute????

Don McMillan __ . . Phone: (313) 986-1436
CS Department / ` |\ /| UUCP: {umich,cfctech}!rphroy!rcsuna!dmcmilla
GM Research Labs | ,_ | | | CSNet: mcmi...@gmr.com
Warren, MI 48090 USA \__/ | | Internet: dmcmilla%rcsun...@umich.edu

Edward Vielmetti

unread,
Sep 25, 1990, 3:40:29 PM9/25/90
to

Biggest collection of paraperlnalia I know of is at tut.cis.ohio-state.edu
in /pub/perl. --Ed

Carl Rigney

unread,
Oct 2, 1990, 1:21:14 PM10/2/90
to
Here's a simple subroutine to calculate Day of the Week using
Zeller's Congruence, which I've found very useful. A lot of
the temporary variables could be omitted by making it harder to read.

If Randal wants to turn it into a one-liner that's fine by me. :-)

#!/usr/local/bin/perl
# usage: zeller yyyy mm dd

$day = &weekday(@ARGV);
print $day,"\n";

sub weekday {
local($year,$month,$day)=@_;
local($y,$m,$c,$yy,$z);

local(@wday) = ( "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" );

$y = $year;
$m = ($month + 10) % 12;
$y-- if ($m > 10);
$c = int ( $y / 100 );
$yy = $year % 100;

$z = ( int ( (26*$m - 2)/10) + $day + $yy + int($yy/4) + int ($c/4) - 2*$c ) % 7;
return $wday[$z];
}

--
Carl Rigney
c...@amd.com
{ames decwrl sun uunet}!amdcad!cdr

"There are no problems in perl, only opportunities for adventure."

0 new messages