Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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??


in reply to Re: Multi-line comments in perl code?
in thread Multi-line comments in perl code?

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:

C-x ( C-a # C-n C-x )
Running it once:

C-x e
Running it 10 times:

C-u 10 C-x e

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".

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://561884]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2020-08-09 09:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which rocket would you take to Mars?










    Results (54 votes). Check out past polls.

    Notices?