Skip to content

Instantly share code, notes, and snippets.

@djanatyn
Created July 18, 2011 02:43
Show Gist options
  • Save djanatyn/1088444 to your computer and use it in GitHub Desktop.
Save djanatyn/1088444 to your computer and use it in GitHub Desktop.
I can't believe this worked.
sub countItems {
(my $target) = @_;
open(TODO, "./.ptd") or die "please create a .ptd file";
@_ = ();
for $_ (<TODO>) { push @_, $1 if /^$target:(.*)$/; }
return @_;
}
sub printTodo {
my @todo = countItems("todo"); my @done = countItems("done");
my $t = 1; my $d = 1;
print "todo:\n";
for my $todo (@todo) { print "$t:$todo\n"; $t++; }
print "done:\n";
for my $done (@done) { print "$d:$done\n"; $d++; }
exit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment