#!/usr/local/bin/perl -i # .tcl corrector .......... # this program replaces if() by if {} in a file, overwriting the original file. # the final ten lines show the exceptions to this rule $to = 0 ; while( <>){ $to += s/if\s+\(([^)]+\)[^(]*\([^)]+)\)\s+\{/if \{($1)\} \{/g; $to += s/if\s+\((\([^)]+\)[^(]*\([^)]+\))\)\s+\{/if \{$1\} \{/g; $to += s/if\s+\((\([^)]+\))\)\s+\{/if \{$1\} \{/g; $to += s/if\s+\(([^)]+)\)\s+\{/if \{$1\} \{/g; $to += s/if\s+\((.+)\)\s+\{/if \{$1\} \{/g; print ; } print STDERR "Changed \{ \} $to times\n" ;