None


Block Comments in Perl

(0 votes, average 0 out of 5)

Like many scripting languages, there is no real way to do block comments in Perl.  The proper way to do a block comment is simply to comment out each line with a # along the left side, and in fact many popular text editors such as vim and emacs facilitiate this behavior (we have a tutorial on how to do it in emacs here).

There is an easier way to make the compiler ignore a block of code if you are interested in a less visibly-obvious solution.  This is great for short-term solutions but it typically should not be used for scripts others will see.

=begin COMMENTS
 
....perl code here....
 
=end COMMENTS

In the example above, "COMMENTS' is just a label and can be changed as long as it is consistent across begin and end.  

Partner Links:
Last Updated on Friday, 24 February 2012 19:01  
Related Articles

» Search and Replace in Emacs

Searching and replacing in emacs is pretty striaghtforward.  The simplest and easiest way to do a query search and replace is to press M-% (typically this is Alt+Shift+5).  You will be prompted to first enter the search string (the string to replace), and then the replacement string.  Emacs will then begin an iterative search; for each selection, press one of the following:y to accept the replace and continuen to deny the replace and continue!  to automatically replace all...

» Conditional (If-Else) Statements in Python

Below is a quick example of how to use an if statement in python: 12345if x==3: print "We are inside an if statement" x = x + 1print "we are no longer in an if statement" Note that unlike most languages, no parentheses are needed, although including parentheses does not violate python syntax.  Anything indented after the if statement is included in the execution if the if statement evaluates to true.  The scope is closed once indentation returns to the indent location of the...

» How to Show Filename in Title Bar in Emacs

Adding the following snippet into your .emacs file (typically located in your home directory) will cause the filename of the current buffer to appear in the title bar.  This is a quick fix that can make managing multiple emacs windows much easier. ;; Show filename in title bar(setq frame-title-format "%b - Emacs")