#!/usr/bin/perl (/(?:}\s*(?:else(?{$/--})| (?{$__="\t"x--$/.$_})))/xo, /(?:{\s*(?{$__="\t"x$/++.$_}))$/o, print($__?"$__":"\t"x$/.$_), undef $__) while (<>)