#!/home/ben/software/install/bin/perl use Z; use C::Tokenize ':all'; use File::Versions ':all'; my @files = <*.go>; for my $file (@files) { my $text = read_text ($file); while ($text =~ m!(($trad_comment_re)\s*func ([A-Z]\S+))!g) { my $a = $1; my $c = $2; my $f = $3; $c = decomment ($c); $c =~ s!^\s*!// !gms; $text =~ s!\Q$a\E!$c\nfunc $f!g; } make_backup ($file); write_text ($file, $text); }