in reply to B::Deparse (with comments)

> Is there a flag for B::Deparse that retains comments?

no¹, but -l will point you to the original source line

-l Add '#line' declarations to the output based on the line and file +locations of the original code.

for instance

perl -MO=Deparse,-l tst_glob.pl #line 1 "tst_glob.pl" $\ = "\n"; #line 3 "tst_glob.pl" $n = 123; #line 5 "tst_glob.pl" $gr = \*n; ...

so just write yourself a post processor script to reinclude the missing lines as comments or POD or here-docs or whatever.

I recommend using Perl, it's good at text processing. ;-)

Cheers Rolf

PS: Je suis Charlie!

¹) IIRC does B::Concise have an option to include original code... (update: yes -src )