perl中打印之间的区别

difference between prints in perl

愚蠢的问题,但对我来说它们似乎是一样的,但我认为应该有所不同。这 3 种印刷品之间有什么已知的区别吗?

类型 1

print qq~ <td>....</td>~

类型 2

print qq|<table>....</table>|

类型 3

print <<EOT
<table>...</table>
EOT

类型 1 和 2,Quote and Quote-like Operators

While we usually think of quotes as literal values, in Perl they function as operators, providing various kinds of interpolating and pattern matching capabilities. Perl provides customary quote characters for these behaviors, but also provides a way for you to choose your quote character for any of them. In the following table, a {} represents any pair of delimiters you choose.

   Customary Generic     Meaning          Interpolates
        ''   q{}          Literal         no
        ""  qq{}          Literal         yes
        ``  qx{}          Command         yes*
            qw{}         Word list        no
        //   m{}       Pattern match      yes*
            qr{}          Pattern         yes*
             s{}{}      Substitution      yes*
            tr{}{}    Transliteration     no (but see below)
             y{}{}    Transliteration     no (but see below)
    <<EOF                 here-doc            yes*
* unless the delimiter is ''.

类型 3。Here-doc

Double quotes indicate that the text will be interpolated using exactly the same rules as normal double quoted strings.

   print <<EOF;
The price is $Price.
EOF
   print << "EOF"; # same as above
The price is $Price.
EOF