Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

by JSchmitz (Canon)
on May 15, 2001 at 21:54 UTC ( #80648=sourcecode: print w/replies, xml ) Need Help??
Category: Utility Scripts
Author/Contact Info
Description: Journal maker for the lazy - more time to drink Whoop-ass and listen to Slayer.

# Listen to Death rips!

my ($next,$date,@when,$month,$day,$year,$mod_date,$file,$last_file,$la
my ($full_month,%suff,$title_date);

# generic "next" or "not done yet" link 
$next = 'index.html';

# get today's date and feed it into an array
$date = `date +%D`;  
@when = split(/\//,$date); 

# define m/d/y variables for today's date
$month = $when[0];
$day = $when[1];
$year = $when[2];

# define the name of the write file
$mod_date = join('',$month,$day,$year);
chomp ($mod_date);
$file = join('',$mod_date,'.html');         

# file containing filename of last entry
$last_file = 'last.cfg';  

# open last entry and change the "next" link to today's entry
# if no last entry exists, print a link to index.html
if (-e $last_file) {
  $lastfile = &last();
  open(PREV, "+<$lastfile") || die "no can open - $lastfile $!\n";  
    @lines = <PREV>;   
    foreach (@lines) {
    print PREV @lines;  
  close(PREV) || die "no can close read file - $lastfile: $!\n";

else {
  open(LAST, ">$last_file") || die "no can make - $last_file $!\n";
    print LAST "index.html";   
  close(LAST) || die "no can close write - $last_file: $!\n";

open(FILE, ">$file") || die "no can make - $file $!\n";

# print out the header
  <meta name="robots" content="noarchive">
<body bgcolor="#336699">
<table width="490" bgcolor="#FFFFFF" cellspacing="0" cellpadding="0" b
    <td valign="top">
        <a href="$lastfile"><img src="img/staple.gif" width="30"
        height="38" alt="[back]" border="0"></a><br>
      <img src="img/clear.gif" width="60" height="1" alt=""></td>
    <td valign="top">
      <img src="img/clear.gif" width="380" height="1" alt=""></td>
    <td><font size="-1" face="arial,verdana">

# print out the title (month and day)
print FILE "      <b>",&full_month," ",&suffixed,"</b><p>\n\n";

# slurp in content and place it in the body
while (<>) { 
  print FILE $_;

# print footer with "next" link
    <td valign="bottom" align="right">
      <a href="$next"><img src="img/curl.gif" width="50" height="40" a

# change file in $last_file to today's entry
open(LAST, ">$last_file") || die "no can make - $last_file $!\n";
  print LAST "$file";
close(LAST) || die "no can close write - $last_file: $!\n";

# Morbid Angel #

# get the filename of the previous entry
sub last {
  open(LAST, "$last_file") || die "no can open - $last_file $!\n";  
    while (<LAST>){
      $last_date = $_;
  close(LAST) || die "no can close read file - $last_file: $!\n";
  return $last_date;

# get the full name of the current month
sub full_month {
  $full_month = `date +%B`;  
  chomp ($full_month);
  return $full_month;

# get the correct suffix for today's numeric value (i.e. the "rd" in 3
sub suffixed {
        %suff = qw(
         1      st
         2      nd
         3      rd
         4      th
         5      th
         6      th
         7      th
         8      th
         9      th
        10      th
        11      th
        12      th
        13      th
        14      th
        15      th
        16      th
        17      th
        18      th
        19      th
        20      th
        21      st
        22      nd
        23      rd
        24      th
        25      th
        26      th
        27      th
        28      th
        29      th
        30      th
        31      st);

  if ($day < 10) {$day =~ s/0//;}
  $title_date = join("",$day,$suff{$day});
  return $title_date;
Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: sourcecode [id://80648]
[perldigious]: Snowshoeing time stevieb? I need to buy a pair so I can walk my German Shepherd properly through the country.
[stevieb]: yeah, I snowshoe a fair amount in the mountains. I also use spikes similar to these very often as well
[perldigious]: Discipulus: alternate link
[stevieb]: LOL you can easily replace "Helsinki" with "Alberta"
[perldigious]: I used to live at the top of a very steep hill stevieb, I can relate to the video. Literally used to have to build up momentum and try to force my vehicle to make it up the hill to park in my driveway properly... didn't always make it.
[choroba]: Why don't they use tire chains?
[perldigious]: First snow, probably not prepared right away choroba.
[stevieb]: it's Quebec... they do weird stuff there :) In the mountains, it is *mandatory* for trucks to use tire chains. Many passenger vehicles do as well (but it's not mandatory for them)
[perldigious]: That stuff can hit fast... like what we just got where I'm at. Saw a few people who had slid OUT of the roundabout I have to drive through to get to work, not used to the ice yet, take awhile to get the hang of it again and make vehicle adjustments.
[stevieb]: man, when the roads are glare ice, I don't even bother going to work or out... unless I absolutely have to, or was already out in the first place

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (10)
As of 2016-12-06 16:34 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (112 votes). Check out past polls.