summaryrefslogtreecommitdiff
path: root/pod/perldata.pod
diff options
context:
space:
mode:
authorPhilip Newton <pne@cpan.org>2001-04-27 18:40:13 +0200
committerJarkko Hietaniemi <jhi@iki.fi>2001-04-27 14:14:12 +0000
commit1d2775625e4ffc457f34262c9f0d9a0fcd085d22 (patch)
tree897882006848816dc30bce8a58a818bab0d3f8a7 /pod/perldata.pod
parentb64ef0c16412e85153146d233da1aa73ec918e8f (diff)
downloadperl-1d2775625e4ffc457f34262c9f0d9a0fcd085d22.tar.gz
[DOC PATCH bleadperl] Document underscores in numeric literals
Message-ID: <3AE9A0ED.5248.CEA127@localhost> p4raw-id: //depot/perl@9884
Diffstat (limited to 'pod/perldata.pod')
-rw-r--r--pod/perldata.pod14
1 files changed, 13 insertions, 1 deletions
diff --git a/pod/perldata.pod b/pod/perldata.pod
index 315f716ed8..48cd0e7cf5 100644
--- a/pod/perldata.pod
+++ b/pod/perldata.pod
@@ -271,11 +271,23 @@ integer formats:
12345
12345.67
.23E-10 # a very small number
- 4_294_967_296 # underline for legibility
+ 4_294_967_296 # underscore for legibility
0xff # hex
0377 # octal
0b011011 # binary
+You are allowed to use an underscore in numeric literals for legibility,
+but in decimal numeric literals (those written in base 10, not
+necessarily with a fractional part), digits may only be grouped in
+threes. For decimal numeric literals containing a fractional part,
+this applies only to the part before the decimal point; the fractional
+part (but not the exponent, if given!) may contain underscores
+anywhere you feel it enhances legibility. Binary, octal, and
+hexadecimal numeric literals may contain underscores in any place --
+so you could, for example, group binary digits by threes (as for a
+Unix-style mode argument such as 0b110_100_100) or by fours (to
+represent nibbles, as in 0b1010_0110) or in other groups.
+
String literals are usually delimited by either single or double
quotes. They work much like quotes in the standard Unix shells:
double-quoted string literals are subject to backslash and variable