Skip to content

Instantly share code, notes, and snippets.

@note103
Last active December 29, 2015 21:19
Show Gist options
  • Save note103/7729687 to your computer and use it in GitHub Desktop.
Save note103/7729687 to your computer and use it in GitHub Desktop.
書籍編集時の注釈作成個数のカウント、その見出し内容の把握に使用。
#!/usr/bin/env perl
use strict;
use warnings;
#notes.txtに注釈テキストを記載。
#行頭に各項目の進捗を表す数種類の記号を付記し、その見出し(注釈タイトル)と作成の進捗状況を一覧化する。
open (FILE, 'notes.txt') or die "$!";
my ($count, $count2, $count3);
while (my $str = <FILE>) {
if ($str =~ /■/) {
$count++;
print "$str";
} elsif ($str =~ /◎/) {
$count2++;
print "$str";
} elsif ($str =~ /□/) {
$count3++;
print "$str";
}
}
print "\nTotal:\t".($count + $count2 + $count3)."\n";
print "■:\t".$count."\n";
print "◎:\t".$count2."\n";
print "□:\t".$count3."\n";
close (FILE);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment