notes/money/compare.pl

29 lines
546 B
Perl
Raw Permalink Normal View History

2023-04-15 17:29:07 +00:00
#!/usr/bin/perl
use strict;
use warnings;
my @subs = `tail -n +3 money/subs.md`;
chomp @subs;
my $today = `date +'%m.%d'`;
chop($today);
my $tommorow = `date -d '+1 day' +'%m.%d'`;
chop($tommorow);
my $fail = 0;
foreach my $sub (@subs) {
my @words = split /\|/, $sub;
my $date = $words[2];
$date =~ s/\./\\\./;
$date =~ s/\*/\./g;
$date =~ s/ //g;
my $regex = "m/$date/";
# print $regex;
if ($today =~ m/$date/ || $tommorow =~ m/$date/) {
print "$sub \n";
$fail = 1;
}
}
exit(1) if $fail;