+use Encode qw(encode_utf8);
+# 処理するファイルを指定。同じフォルダに置く。
+my $file = '201808.csv';
+# ファイルの改行を全部削り、1行にしてスカラ変数に読み込む
+open my $FH, '<:encoding(utf16le)', $file;
+# BOL(Before of Line)という文字列をくっつけて
+$str =~ s|(\d+/\d+)|BOL$1|g;
+my @array = split /BOL/, $str;
+for my $entry (@array) {
+ # CSVとか言いつつタブ区切りなのでタブで分割する
+ my ( $date, $time, $text ) = split /\t/, $entry;
+ next unless ( defined $date && defined $time && defined $text );
+ # ファイル名から年(先頭から4桁の数字)を取り出す
+ # びっくりすることに、CSVファイルの日付が信用できない
+ # https://twitter.com/sironekotoro/status/1033613225303003136
+ # https://twitter.com/sironekotoro/status/1033665694682951680
+ # 7/28 (終日) 終日、来客はなく、東京・富ヶ谷の私邸で過ごす
+ # 置換使って 00:00:00 に置き換える
+ my $t = Time::Piece->strptime( "$year $date $time", '%Y %m/%e %H:%M' );
+ push @dousei, { epoch => $t->epoch, text => $text };
+# 配列の中のハッシュリファレンス中のエポック秒を元にソートする
+@dousei = sort { $a->{epoch} <=> $b->{epoch} } @douseia;
+ my $t = Time::Piece->strptime( $e->{epoch}, '%s' );
+ say $t->ymd, "\t", $t->hms, "\t", encode_utf8( $e->{text} );