diff options
-rw-r--r-- | handy.h | 2 | ||||
-rw-r--r-- | pod/perlapi.pod | 2 | ||||
-rw-r--r-- | pod/perldata.pod | 3 | ||||
-rw-r--r-- | pod/perlfaq6.pod | 3 | ||||
-rw-r--r-- | pod/perlfaq9.pod | 3 | ||||
-rw-r--r-- | pod/perllocale.pod | 7 | ||||
-rw-r--r-- | pod/perlre.pod | 7 |
7 files changed, 16 insertions, 11 deletions
@@ -261,7 +261,7 @@ C<strncmp>). /* =for apidoc Am|bool|isALNUM|char ch Returns a boolean indicating whether the C C<char> is an ASCII alphanumeric -character or digit. +character (including underscore) or digit. =for apidoc Am|bool|isALPHA|char ch Returns a boolean indicating whether the C C<char> is an ASCII alphabetic diff --git a/pod/perlapi.pod b/pod/perlapi.pod index cd467ba8ed..2532620d7c 100644 --- a/pod/perlapi.pod +++ b/pod/perlapi.pod @@ -670,7 +670,7 @@ Undefines the hash. =item isALNUM Returns a boolean indicating whether the C C<char> is an ASCII alphanumeric -character or digit. +character (including underscore) or digit. bool isALNUM(char ch) diff --git a/pod/perldata.pod b/pod/perldata.pod index ac444fa17c..a2bb840b01 100644 --- a/pod/perldata.pod +++ b/pod/perldata.pod @@ -303,7 +303,8 @@ price is $Z<>100." print "The price is $Price.\n"; # interpreted As in some shells, you can enclose the variable name in braces to -disambiguate it from following alphanumerics. You must also do +disambiguate it from following alphanumerics (and underscores). +You must also do this when interpolating a variable into a string to separate the variable name from a following double-colon or an apostrophe, since these would be otherwise treated as a package separator: diff --git a/pod/perlfaq6.pod b/pod/perlfaq6.pod index bf007ee26b..29136abd96 100644 --- a/pod/perlfaq6.pod +++ b/pod/perlfaq6.pod @@ -415,7 +415,8 @@ Use the split function: Note that this isn't really a word in the English sense; it's just chunks of consecutive non-whitespace characters. -To work with only alphanumeric sequences, you might consider +To work with only alphanumeric sequences (including underscores), you +might consider while (<>) { foreach $word (m/(\w+)/g) { diff --git a/pod/perlfaq9.pod b/pod/perlfaq9.pod index 16a803c997..d1bd593dfe 100644 --- a/pod/perlfaq9.pod +++ b/pod/perlfaq9.pod @@ -215,7 +215,8 @@ Here's an example of decoding: $string =~ s/%([a-fA-F0-9]{2})/chr(hex($1))/ge; Encoding is a bit harder, because you can't just blindly change -all the non-alphanumunder character (C<\W>) into their hex escapes. +all characters that are not letters, digits or underscores (C<\W>) +into their hex escapes. It's important that characters with special meaning like C</> and C<?> I<not> be translated. Probably the easiest way to get this right is to avoid reinventing the wheel and just use the URI::Escape module, diff --git a/pod/perllocale.pod b/pod/perllocale.pod index 55ccf441fd..ddb5a6e710 100644 --- a/pod/perllocale.pod +++ b/pod/perllocale.pod @@ -449,7 +449,7 @@ if you "use locale". a A b B c C d D e E a b c d e A B C D E -Here is a code snippet to tell what alphanumeric +Here is a code snippet to tell what "word" characters are in the current locale, in that locale's order: use locale; @@ -518,8 +518,9 @@ results, and so always obey the current C<LC_COLLATE> locale. In the scope of S<C<use locale>>, Perl obeys the C<LC_CTYPE> locale setting. This controls the application's notion of which characters are alphabetic. This affects Perl's C<\w> regular expression metanotation, -which stands for alphanumeric characters--that is, alphabetic and -numeric characters. (Consult L<perlre> for more information about +which stands for alphanumeric characters--that is, alphabetic, +numeric, and including other special characters such as the underscore or +hyphen. (Consult L<perlre> for more information about regular expressions.) Thanks to C<LC_CTYPE>, depending on your locale setting, characters like 'E<aelig>', 'E<eth>', 'E<szlig>', and 'E<oslash>' may be understood as C<\w> characters. diff --git a/pod/perlre.pod b/pod/perlre.pod index a82ab32b73..15e58c1cf9 100644 --- a/pod/perlre.pod +++ b/pod/perlre.pod @@ -254,15 +254,15 @@ backspace are control characters. All characters with ord() less than =item graph -Any alphanumeric or punctuation character. +Any alphanumeric or punctuation (special) character. =item print -Any alphanumeric or punctuation character or space. +Any alphanumeric or punctuation (special) character or space. =item punct -Any punctuation character. +Any punctuation (special) character. =item xdigit @@ -381,6 +381,7 @@ use for a pattern. Simply quote all non-"word" characters: $pattern =~ s/(\W)/\\$1/g; +(If C<use locale> is set, then this depends on the current locale.) Today it is more common to use the quotemeta() function or the C<\Q> metaquoting escape sequence to disable all metacharacters' special meanings like this: |