Single-line and multiline annotation syntax in Perl _perl

Source: Internet
Author: User
Tags comments trim

As with most other programming languages, Single-line comments in Perl also begin with a #, such as:

Copy Code code as follows:

#print "hello,world!";

But multiline annotations, different languages have different ways of commenting, such as:
java,c/c++:
Copy Code code as follows:

/*
* Comment on several lines
* Comment on several lines
* Comment on several lines
*/

Python:
Copy Code code as follows:

"""
With three double quotes, multiline comment
With three double quotes, multiline comment
With three double quotes, multiline comment

"""

'''
With three single quotes, multiple lines of comments
With three single quotes, multiple lines of comments
With three single quotes, multiple lines of comments

'''


Ruby:
Copy Code code as follows:

=begin

This is a comment.
This is a comment, too.
This is a comment, too.

=end


Shell:
Copy Code code as follows:

# This is a comment.
# This is a comment, too.
# This is a comment, too.

Perl: Multiline annotations are:
Copy Code code as follows:

=

Multi-line Comment content
Multi-line Comment content
Multi-line Comment content

=cut


Description: The first equal sign must be followed by a character!
For example:
Copy Code code as follows:

#! C:\Perl\bin\perl-w
Use strict;
Use warnings;
Use String::util ': all ';
Use 5.016;

=my $element = "abc";
printf "<%s>\n", Trim ($element);
printf "<%s>\n", Trim ($element, right => 0);
printf "<%s>\n", Trim ($element, left => 0);
=cut

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.