Next: Invalid Uses Of String Interpolation, Previous: How to Extract Hash Keys, Up: Perl [Contents][Index]
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
.
print gettext "Hello World!";
print gettext 'Hello World!';
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.
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.
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).
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!
Next: Invalid Uses Of String Interpolation, Previous: How to Extract Hash Keys, Up: Perl [Contents][Index]