summaryrefslogtreecommitdiff
path: root/pod/perldata.pod
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-04-29 15:55:39 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-04-29 15:55:39 +0000
commit928753ea20dfcc4327533c22eecccbc215e82fee (patch)
treec1ddf60e7c74061943aa1556daf62f093b023379 /pod/perldata.pod
parentaa58aa353209e3416c78e241b039154fdfd9415b (diff)
downloadperl-928753ea20dfcc4327533c22eecccbc215e82fee.tar.gz
Changed the underscore/undebar syntax in numeric constants;
now any grouping will do, as long as the underscores are not consecutive (so "zero-grouping" is out), and they do not begin or end the integer or fractional parts. p4raw-id: //depot/perl@9905
Diffstat (limited to 'pod/perldata.pod')
-rw-r--r--pod/perldata.pod24
1 files changed, 13 insertions, 11 deletions
diff --git a/pod/perldata.pod b/pod/perldata.pod
index 48cd0e7cf5..42e3af723c 100644
--- a/pod/perldata.pod
+++ b/pod/perldata.pod
@@ -271,22 +271,24 @@ integer formats:
12345
12345.67
.23E-10 # a very small number
+ 3.14_15_92 # a very important number
4_294_967_296 # underscore for legibility
0xff # hex
+ 0xdead_beef # more 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.
+You are allowed to use underscores (underbars) in numeric literals for
+legibility, as long as the underscores are spaced at least one digit
+apart, and they do not begin or end the integer or fractional part.
+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.
+
+(Note that if you try to begin a number with an underscore, it won't
+even be understood as a number, it will be understood as a bareword,
+which depending on the context may mean for example a string constant,
+a function call, or a filehandle.)
String literals are usually delimited by either single or double
quotes. They work much like quotes in the standard Unix shells: