Drop "v" prefix from sprintf("%vd", $^V).
Gisle Aas [Mon, 12 Dec 2005 10:41:04 +0000 (10:41 +0000)]
The sprintf documentation has this example:

   printf "version is v%vd\n", $^V;

and it printed 'version is vv5.9.3\n'.

p4raw-id: //depot/perl@26326

sv.c
t/op/sprintf.t

diff --git a/sv.c b/sv.c
index df957d5..e0165d4 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -8011,6 +8011,10 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
                        q++; /* skip past the rest of the %vd format */
                        eptr = (const char *) vecstr;
                        elen = veclen;
+                       if (elen && *eptr == 'v') {
+                           eptr++;
+                           elen--;
+                       }
                        vectorize=FALSE;
                        goto string;
                }
index 7d35cb2..6cd9ec3 100755 (executable)
@@ -241,6 +241,8 @@ __END__
 >%+vd<      >chr(1)<      >+1<
 >%#vd<      >chr(1)<      >1<
 >%vd<       >"\01\02\03"< >1.2.3<
+>%vd<       >v1.2.3<      >1.2.3<
+>%vd<       >[version::qv("1.2.3")]< >1.2.3<
 >%v.3d<     >"\01\02\03"< >001.002.003<
 >%0v3d<     >"\01\02\03"< >001.002.003<
 >%-v3d<     >"\01\02\03"< >1  .2  .3  <