how to print v-string?
our $VERSION = v2.1;
print "$VERSION\n\n";
prints smileys.
☻☺
What do you mean by print v-strings? What output do you want?
You could do this:
printf "%vd", $VERSION; # prints "2.1"
or this:
print version::->parse($VERSION)->stringify; # prints "v2.1"
or this:
print version::->parse($VERSION)->normal; # prints "v2.1.0"
or this:
print version::->parse($VERSION)->numify; # prints "2.001000"
Or (best choice of all) you could just avoid using v-strings altogether.
In Simpler terms, V-Strings are used to convert ASCII numbers to characters.
For example, if we need to print a string "car" using V-String, we need to lookup ASCII value for each character in ASCII table (http://www.asciitable.com/)
c = 99,a = 97,r = 114
So,
$var = v99.97.114;
print("$var \n");
The above statement will print "car"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With