(gettext.info)Quote-like Expressions


Next: Interpolation I Prev: Special Keywords Up: Perl
Enter node , (file) or (file)node

15.5.18.4 What are Strings And Quote-like Expressions?
......................................................

   Perl offers a plethora of different string constructs.  Those that
can be used either as arguments to functions or inside braces for hash
lookups are generally supported by ‘xgettext’.

   • *double-quoted strings*
          print gettext "Hello World!";

   • *single-quoted strings*
          print gettext 'Hello World!';

   • *the operator qq*
          print gettext qq |Hello World!|;
          print gettext qq <E-mail: <guido\@imperia.net>>;

     The operator ‘qq’ is fully supported.  You can use arbitrary
     delimiters, including the four bracketing delimiters (round, angle,
     square, curly) that nest.

   • *the operator q*
          print gettext q |Hello World!|;
          print gettext q <E-mail: <guido@imperia.net>>;

     The operator ‘q’ is fully supported.  You can use arbitrary
     delimiters, including the four bracketing delimiters (round, angle,
     square, curly) that nest.

   • *the operator qx*
          print gettext qx ;LANGUAGE=C /bin/date;
          print gettext qx [/usr/bin/ls | grep '^[A-Z]*'];

     The operator ‘qx’ is fully supported.  You can use arbitrary
     delimiters, including the four bracketing delimiters (round, angle,
     square, curly) that nest.

     The example is actually a useless use of ‘gettext’.  It will invoke
     the ‘gettext’ function on the output of the command specified with
     the ‘qx’ operator.  The feature was included in order to make the
     interface consistent (the parser will extract all strings and
     quote-like expressions).

   • *here documents*
          print gettext <<'EOF';
          program not found in $PATH
          EOF

          print ngettext <<EOF, <<"EOF";
          one file deleted
          EOF
          several files deleted
          EOF

     Here-documents are recognized.  If the delimiter is enclosed in
     single quotes, the string is not interpolated.  If it is enclosed
     in double quotes or has no quotes at all, the string is
     interpolated.

     Delimiters that start with a digit are not supported!


automatically generated by info2www version 1.2.2.9