Created
August 20, 2013 05:52
-
-
Save uasi/6277537 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 5.014; | |
use warnings; | |
use Getopt::Long; | |
GetOptions( | |
'dry-run|n' => \my $opt_dry_run, | |
'force|f' => \my $opt_force, | |
); | |
die "Neither -n nor -f given\n" unless $opt_dry_run || $opt_force; | |
my $replace = ($opt_dry_run && $opt_force) ? undef | |
: $opt_force ? 1 | |
: undef; | |
do { | |
local $^I = $replace; | |
my $jisyo_file = shift || ''; | |
die "Could not open SKK-JISYO '$jisyo_file'\n" unless -f $jisyo_file; | |
@ARGV = $jisyo_file; | |
while (<>) { | |
if ($replace) { | |
print unless m|//$|; | |
} | |
else { | |
print "Would remove $_" if m|//$|; | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment