-
-
Save tene/1088461 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
#!/usr/bin/perl | |
use v5.10; | |
use IO::File qw//; | |
sub countItems { | |
(my $target) = @_; | |
my $fh = IO::File->new('.ptd', 'r') or die 'no .ptd file found'; | |
return map { /^$target:(.*)/ } <$fh>; | |
} | |
sub printTodo { | |
my @todo = countItems('todo'); my @done = countItems('done'); | |
my $t = 1; my $d = 1; | |
say 'todo:'; | |
for my $todo (@todo) { print "$t:$todo"; $t++; } | |
say 'done:'; | |
for my $done (@done) { print "$d:$done"; $d++; } | |
exit; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment