Skip to content

Instantly share code, notes, and snippets.

@lanejames35
Created May 8, 2020 18:54
Show Gist options
  • Save lanejames35/f7f90b2db038d0628938ff81ef761614 to your computer and use it in GitHub Desktop.
Save lanejames35/f7f90b2db038d0628938ff81ef761614 to your computer and use it in GitHub Desktop.
Timesheet generator
###############
# Generate a time sheet entry
###############
#!/usr/bin/perl
# Formats for month names
@months = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec );
@weekdays = qw( Mon Tue Wed Thurs Fri Sat Sun );
# get todays date
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
# try to open the file
open(DATA, ">>timesheet.csv") || die "Could not open the file";
# append a recrod
print DATA "$weekdays[$wday] $months[$mon] $mday,07:00,15:00,1hr\n";
# close the file and clear the buffer
close(DATA) || die "Could not close the file";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment