From: Philip Newton Date: Fri, 27 Apr 2001 16:40:13 +0000 (+0200) Subject: [DOC PATCH bleadperl] Document underscores in numeric literals X-Git-Tag: accepted/trunk/20130322.191538~32152 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1d2775625e4ffc457f34262c9f0d9a0fcd085d22;p=platform%2Fupstream%2Fperl.git [DOC PATCH bleadperl] Document underscores in numeric literals Message-ID: <3AE9A0ED.5248.CEA127@localhost> p4raw-id: //depot/perl@9884 --- diff --git a/pod/perldata.pod b/pod/perldata.pod index 315f716..48cd0e7 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