diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-02-06 13:56:45 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-02-06 13:56:45 +0000 |
commit | 3cb0bbe5af1ac1b0e46bbee66b7b457629e7ffa3 (patch) | |
tree | 53e06029d69787129e9b2245a4648e61fcdb73e1 /pod | |
parent | c4410b1b816ab84616660ccfbce83a639eb24398 (diff) | |
download | perl-3cb0bbe5af1ac1b0e46bbee66b7b457629e7ffa3.tar.gz |
support sprintf("v%v", v1.2.3) (works on any string argument, in
fact); add tests for version tuples
p4raw-id: //depot/perl@4998
Diffstat (limited to 'pod')
-rw-r--r-- | pod/perldiag.pod | 6 | ||||
-rw-r--r-- | pod/perlfunc.pod | 4 | ||||
-rw-r--r-- | pod/perlop.pod | 17 |
3 files changed, 19 insertions, 8 deletions
diff --git a/pod/perldiag.pod b/pod/perldiag.pod index b7e115fb71..7891bc2ad3 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -2170,6 +2170,12 @@ on portability concerns. See also L<perlport> for writing portable code. +=item Octal number in vector unsupported + +(F) Numbers with a leading C<0> are not currently allowed in vectors. The +octal number interpretation of such numbers may be supported in a future +version. + =item Odd number of elements in hash assignment (W) You specified an odd number of elements to initialize a hash, which diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index fa8504ed38..c9efcd1231 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -4310,6 +4310,10 @@ In addition, Perl permits the following widely-supported conversions: %n special: *stores* the number of characters output so far into the next variable in the parameter list +And the following Perl-specific conversion: + + %v a string, output as a tuple of integers ("Perl" is 80.101.114.108) + Finally, for backward (and we do mean "backward") compatibility, Perl permits these unnecessary but widely-supported conversions: diff --git a/pod/perlop.pod b/pod/perlop.pod index 150813e711..d932704666 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -1804,14 +1804,15 @@ in a bit vector. =head2 Version tuples -A version number of the form C<v1.2.3.4> is parsed as a dual-valued literal. -It has the string value of C<"\x{1}\x{2}\x{3}\x{4}"> (i.e., a utf8 string) -and a numeric value of C<1 + 2/1000 + 3/1000000 + 4/1000000000>. This is -useful for representing and comparing version numbers. - -Version tuples are accepted by both C<require> and C<use>. The C<$^V> variable -contains the running Perl interpreter's version in this format. -See L<perlvar/$^V>. +A literal of the form C<v1.20.300.4000> is parsed as a dual-valued quantity. +It has the string value of C<"\x{1}\x{14}\x{12c}\x{fa0}"> (i.e., a UTF-8 +string) and a numeric value of C<1 + 20/1000 + 300/1000000 + 4000/1000000000>. +This is useful for representing Unicode strings, and for comparing version +numbers using the string comparison operators, C<cmp>, C<gt>, C<lt> etc. + +Such "version tuples" or "vectors" are accepted by both C<require> and +C<use>. The C<$^V> variable contains the running Perl interpreter's +version in this format. See L<perlvar/$^V>. =head2 Integer Arithmetic |