gettext: Quote-like Expressions
1
1 15.5.18.4 What are Strings And Quote-like Expressions?
1 ......................................................
1
1 Perl offers a plethora of different string constructs. Those that
1 can be used either as arguments to functions or inside braces for hash
1 lookups are generally supported by ‘xgettext’.
1
1 • *double-quoted strings*
1 print gettext "Hello World!";
1
1 • *single-quoted strings*
1 print gettext 'Hello World!';
1
1 • *the operator qq*
1 print gettext qq |Hello World!|;
1 print gettext qq <E-mail: <guido\@imperia.net>>;
1
1 The operator ‘qq’ is fully supported. You can use arbitrary
1 delimiters, including the four bracketing delimiters (round, angle,
1 square, curly) that nest.
1
1 • *the operator q*
1 print gettext q |Hello World!|;
1 print gettext q <E-mail: <guido@imperia.net>>;
1
1 The operator ‘q’ is fully supported. You can use arbitrary
1 delimiters, including the four bracketing delimiters (round, angle,
1 square, curly) that nest.
1
1 • *the operator qx*
1 print gettext qx ;LANGUAGE=C /bin/date;
1 print gettext qx [/usr/bin/ls | grep '^[A-Z]*'];
1
1 The operator ‘qx’ is fully supported. You can use arbitrary
1 delimiters, including the four bracketing delimiters (round, angle,
1 square, curly) that nest.
1
1 The example is actually a useless use of ‘gettext’. It will invoke
1 the ‘gettext’ function on the output of the command specified with
1 the ‘qx’ operator. The feature was included in order to make the
1 interface consistent (the parser will extract all strings and
1 quote-like expressions).
1
1 • *here documents*
1 print gettext <<'EOF';
1 program not found in $PATH
1 EOF
1
1 print ngettext <<EOF, <<"EOF";
1 one file deleted
1 EOF
1 several files deleted
1 EOF
1
1 Here-documents are recognized. If the delimiter is enclosed in
1 single quotes, the string is not interpolated. If it is enclosed
1 in double quotes or has no quotes at all, the string is
1 interpolated.
1
1 Delimiters that start with a digit are not supported!
1