in reply to v1.2.3 syntax (vector of ordinals)

perl 5.6.1:
> perldoc -f sprintf
v interpret string as a vector of integers, output as
  numbers separated either by dots, or by an arbitrary
  string received from the argument list when the flag
  is preceded by C<*>
 
The "v" flag is useful for displaying ordinal values of
  characters in arbitrary strings:
printf "version is v%vd\n", $^V; # Perl's version printf "address is %*vX\n", ":", $addr; # IPv6 address printf "bits are %*vb\n", " ", $bits; # random bitstring


  p

Replies are listed 'Best First'.
Re: Re: v1.2.3 syntax
by John M. Dlugosz (Monsignor) on Jul 19, 2001 at 19:11 UTC
    printf v flag: cool!

    But, doesn't UTF-8 encoding get in the way of dumping arbitrary bitstrings that way? $bits, for example, may contain illegal UTF-8 encodings.

    Experiments indicate that it's respecting the char/byte discipline attached to the string. That's good. Now if only we had a good way to test and force string disciplines...

    —John