develooper Front page | perl.perl5.porters | Postings from April 2014

vec() in perl-5.19.11

Thread Next
From:
Gisle Aas
Date:
April 29, 2014 22:02
Subject:
vec() in perl-5.19.11
Message ID:
CAMx+QJ6SAv05nmpnc7bmp0Wo+sjcx=ssxCcE-P_PZ8HDuCQd9A@mail.gmail.com
Consider the following program:

  #!perl -l
  $x = substr "\x{100}\xff\xfe", 1;
  print vec($x, 0, 8);
  print vec($x, 0, 8);

when I run it with perl-5.19.11 it prints:

  195
  255

so it looks like the first vec() returns the first byte without downgrading
the string first, but at the same time has the side effect of downgrading
$x, so the next call returns the downgraded byte.

With perl-5.18 and older I get the expected values:

  255
  255

--Gisle

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About