Created
July 18, 2011 02:43
-
-
Save djanatyn/1088444 to your computer and use it in GitHub Desktop.
I can't believe this worked.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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