![]() |
|
Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re^2: Multi-line comments in perl code?by doom (Deacon) |
on Jul 17, 2006 at 23:05 UTC ( #561884=note: print w/replies, xml ) | Need Help?? |
Emacs also has a "ESC x comment-region" command (which I have bound to a key, myself). Select the block of
multi-line text, do a comment-region, and in cperl-mode, "# " will magically
appear in front of every line. If you do a "C-u" prefix first, you can use the same command to remove the commenting.
Alternately, it's not at all difficult to write keystroke macros that do things like "insert a '#' in front of this line and then move down one line", which you can loop to comment a series of lines. The default keystrokes for that (Off the top of my head, and untested): Defining the macro:
Running it once:
Running it 10 times:
My personal preference: don't use one of the workarounds. Everyone understands "#" commented lines, but many will find your workaround confusing. Optimize for readability, not for ease of typing. But if you do use a workaround, my preference would be for abusing pod ('=for comment/=cut'), which is endorsed by Damien Conway in "Perl Best Practices".
In Section
Seekers of Perl Wisdom
|
|