Skip to content

Instantly share code, notes, and snippets.

@mix3 mix3/search.pl
Created Sep 28, 2015

Embed
What would you like to do?
括弧の範囲を探すやーつ
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
my $depth = 0;
my $str = "";
while (<>) {
if (/sqlt_deploy_hook\s+\{/) {
$depth++;
if (/\}/) {
$depth--;
}
$str .= $_;
next;
}
if ($depth) {
if (/\{/) {
$depth++;
}
if (/\}/) {
$depth--;
}
$str .= $_;
}
}
if ($str && $str !~ /next::method/) {
print $str;
exit 1;
}
exit 0;
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.