Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#!/usr/bin/perl
use strict;
open(DID, ">>/path/to/iDid.txt");
my $time = &gettime();
sub gettime {
my @timearray = (my $_sec,my $_min,my $_hour,my $_mday,my $_mon,my $_year,my $_wday,my $_yday,my $_isdst) = localtime(time);
my $months = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')[(localtime)[4]];
my $currenthour = sprintf ("%0.2d",$_hour);
my $currentmin = sprintf ("%0.2d",$_min);
my $currentsec = sprintf ("%0.2d",$_sec);
my $currentyear = $_year+1900;
my $currentday = sprintf ("%0.2d",$timearray[3]);
my $currentmonth = sprintf ("%0.2d",$timearray[4] + 1);
my $today = "$currentyear-$currentmonth-$currentday";
my $currenttime = "$today $currenthour:$currentmin:$currentsec";
return $currenttime;
}
print "I did... ";
my $accomplishment = ;
print DID “$time$accomplishment\n”;
close(DID);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment