-
-
Save note103/a28597ca8824a4e8e83bc4f843184bf3 to your computer and use it in GitHub Desktop.
空白行が来るごとに数字をカウントアップしつつ挿入する
This file contains 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/env perl | |
use strict; | |
use warnings; | |
use feature 'say'; | |
my @data = <DATA>; | |
my $num = 1; #<= 開始時点の数字を入れる | |
for my $data (@data) { | |
chomp $data; | |
if ($data =~ /\A\z/) { | |
say "# $num"; | |
$num++; | |
} | |
else { | |
say $data; | |
} | |
} | |
__DATA__ | |
# 以下に必要なデータを入れる |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment