#!/usr/bin/perl -w # check ~/.bloodrc to see when you can give again. # file has unix time of when you can give plus a message: # 1146196800 You can give blood again after 2006-04-27 use strict; my $file = $ENV{'HOME'} . "/.bloodrc"; open (F, "< $file") or die "$file not found"; $_ = ; close(F); my ($then, $human, @notes) = split; my $now = time(); my $interval = int(($then - $now)/86400); my $donate = "You can donate again after $human"; $_ = ($interval > 0) ? "$donate, in $interval days." : "$donate, today if you like."; s/days/day/ if $interval == 1; print "$_\n@notes\n"; exit(0);