in reply to How do I replace brackets with XML tags?

Keep a stack of tagnames around. This will even work if things are nested. (Of course, if the file is in bad shape, you'll have to go through by hand, but that's the case anyway.) Pseudo-code:
# find something like @interface push @stack, 'interface'; # parse lines until reaching a closing curly my $tagname = pop @stack; print "</$tagname>";