Create a gist now

Instantly share code, notes, and snippets.

@note103 /blank_num.pl Secret
Last active May 18, 2017

What would you like to do?
空白行が来るごとに数字をカウントアップしつつ挿入する
#!/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