Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Re: Re: Surprising Syntax

by Chmrr (Vicar)
on Aug 06, 2002 at 05:48 UTC ( #187940=note: print w/replies, xml ) Need Help??

in reply to Re: Re: Surprising Syntax
in thread Surprising Syntax

Close -- it stands for both "vector" and/or "version" string. See Everything you wanted to know about Module Version Numbers and Checking for more while I hunt down something from the perl distribution which discussed them.

Update: Can't find anything about it in the core perl documentation, but there's a small bit about them in Programming Perl, version 3. A short exerpt from section 2.6.7 from my version on Safari:

A literal that begins with a v and is followed by one or more dot-separated integers is treated as a string literal composed of characters with the specified ordinal values:

$crlf = v13.10;           # ASCII carriage return, line feed

These are called v-strings, short for "vector strings" or "version strings" or anything else you can think of that starts with "v" and deals with lists of integers. They provide an alternate and more legible way to construct strings when you want to specify the numeric values of each character. Thus, v1.20.300.4000 is a more winsome way to produce the same string value as any of:

"\x{1}\x{14}\x{12c}\x{fa0}" pack("U*", 1, 20, 300, 4000) chr(1) . chr(20) . chr(300) . chr(4000)

perl -pe '"I lo*`+$^X$\"$]!$/"=~m%(.*)%s;$_=$1;y^`+*^e v^#$&V"+@( NO CARRIER'

Replies are listed 'Best First'.
Re: Surprising Syntax
by crenz (Priest) on Aug 06, 2002 at 06:06 UTC

    $crlf = v13.10;

    Unfortunately, that is not true on ActiveState perl 5.6.1.

    v10 produces the bytes 0x0D 0x0A, so that v13.10 results in 0x0D 0x0D 0x0A. I guess this has to do with STDOUT being considered an "ascii" file on Windows.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://187940]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2017-04-26 11:12 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (473 votes). Check out past polls.