diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-01-20 20:15:30 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-01-20 20:15:30 +0000 |
commit | 49cb94c67d828cadfe8cac24ae5955cf752eb2df (patch) | |
tree | 52cd7eb3150a55b88b170492879696fbbd72bda9 /pod/perlop.pod | |
parent | 3384d91b59037da95d8c4ea56131ee567d0c261c (diff) | |
download | perl-49cb94c67d828cadfe8cac24ae5955cf752eb2df.tar.gz |
Document and test the new qu operator.
p4raw-id: //depot/perl@8485
Diffstat (limited to 'pod/perlop.pod')
-rw-r--r-- | pod/perlop.pod | 66 |
1 files changed, 39 insertions, 27 deletions
diff --git a/pod/perlop.pod b/pod/perlop.pod index 0bb506ddc7..ebe52c568e 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -645,6 +645,7 @@ any pair of delimiters you choose. Customary Generic Meaning Interpolates '' q{} Literal no "" qq{} Literal yes + qu{} Literal yes, Unicode `` qx{} Command yes (unless '' is delimiter) qw{} Word list no // m{} Pattern match yes (unless '' is delimiter) @@ -1011,6 +1012,44 @@ Options are: See L<perlre> for additional information on valid syntax for STRING, and for a detailed look at the semantics of regular expressions. +=item qw/STRING/ + +Evaluates to a list of the words extracted out of STRING, using embedded +whitespace as the word delimiters. It can be understood as being roughly +equivalent to: + + split(' ', q/STRING/); + +the difference being that it generates a real list at compile time. So +this expression: + + qw(foo bar baz) + +is semantically equivalent to the list: + + 'foo', 'bar', 'baz' + +Some frequently seen examples: + + use POSIX qw( setlocale localeconv ) + @EXPORT = qw( foo bar baz ); + +A common mistake is to try to separate the words with comma or to +put comments into a multi-line C<qw>-string. For this reason, the +C<use warnings> pragma and the B<-w> switch (that is, the C<$^W> variable) +produces warnings if the STRING contains the "," or the "#" character. + +=item qu/STRING/ + +Like L<qq> but generates Unicode for characters whose code points are +greater than 128, or 0x80. Such characters can be generated using +the \xHH (for characters 0x80...0xff, or 128..255) and \x{HHH...} +notations (for characters 0x100..., or greater than 256). + +(In qq/STRING/, or "", both the \xHH and the \x{HHH...} generate +bytes for the 0x80..0xff range (these bytes are host-dependent), +and the \x{HHH...} can be used to generate Unicode.) + =item qx/STRING/ =item `STRING` @@ -1092,33 +1131,6 @@ Just understand what you're getting yourself into. See L<"I/O Operators"> for more discussion. -=item qw/STRING/ - -Evaluates to a list of the words extracted out of STRING, using embedded -whitespace as the word delimiters. It can be understood as being roughly -equivalent to: - - split(' ', q/STRING/); - -the difference being that it generates a real list at compile time. So -this expression: - - qw(foo bar baz) - -is semantically equivalent to the list: - - 'foo', 'bar', 'baz' - -Some frequently seen examples: - - use POSIX qw( setlocale localeconv ) - @EXPORT = qw( foo bar baz ); - -A common mistake is to try to separate the words with comma or to -put comments into a multi-line C<qw>-string. For this reason, the -C<use warnings> pragma and the B<-w> switch (that is, the C<$^W> variable) -produces warnings if the STRING contains the "," or the "#" character. - =item s/PATTERN/REPLACEMENT/egimosx Searches a string for a pattern, and if found, replaces that pattern |