Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Perlのソースコードに自動でセミコロンつけるやつ
#! /usr/bin/env ruby
file = ARGV.first
code = open(file).read
def append_semicolon(code, time)
code.split(/\n/).enum_with_index.map{|line, num|
time[num] == 1 ? line + ";" : line
}.join("\n")
end
(1.upto 1.0/0).each{ |i|
system "clear"
new_code = append_semicolon(code, i)
puts new_code
puts
puts
system("echo '#{new_code}' | perl -wc")
if $? == 0
puts "created out.pl"
open("out.pl", "w"){ |f|
f.write new_code
}
exit
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.