Thread Werte in Hashes: Problem bei Werten mit v am Anfang (7 answers)
Opened by GwenDragon at 2005-11-13 16:53

GwenDragon
 2005-11-13 17:18
#60088 #60088
User since
2005-01-17
14711 Artikel
Admin1
[Homepage]
user image
@Ronnie

Vielfachen drachlichen Dank.

Ich konnte mich nämlich nicht mehr genau entsinnen, was das war.

Quote
A literal of the form v1.20.300.4000 is parsed as a string composed of characters with the specified ordinals. This provides an alternative, more readable way to construct strings, rather than use the somewhat less readable interpolation form "\x{1}\x{14}\x{12c}\x{fa0}".
This is useful for representing Unicode strings, and for comparing version ``numbers'' using the string comparison operators, cmp, gt, lt etc. If there are two or more dots in the literal, the leading v may be omitted.

   print v9786;              # prints UTF-8 encoded SMILEY, "\x{263a}"
   print v102.111.111;       # prints "foo"
   print 102.111.111;        # same
in perldata von 5.6.1
Ja, in perdata steht es. Aber useful!?? Nein.

Kein Wunder dass bei 5.8 steht:
Quote
The marginal benefits of v-strings were greatly outweighed by the potential for Surprise and Confusion.


Quote
Note that since Perl 5.8.1 the single-number v-strings (like v65 ) are not v-strings before the => operator (which is usually used to separate a hash key from a hash value), instead they are interpreted as literal strings ('v65').

Das hatte ich aber erwartet.

Kein Wunder, dass ich darüber fiel. Noch keine v-strings benutzt.

Also besser solche Keys in einfache Anführungszeichen.

Böse Falle.\n\n

<!--EDIT|GwenDragon|1131897860-->

View full thread Werte in Hashes: Problem bei Werten mit v am Anfang