[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] vec() & unpack() 5.0.5r1m



PowerMac 7100/66
MacPerl v5.0.5r1m

Why does the following script only produce the expected results the first time
that the script is run? 

for ($i = 0;$i < 5;$i++) {
    vec($vector, $i, 1) = 1;
    print $i, '. Setbits are: ', unpack("%32b*", $vector), "\n";
}
print '$vector is: "', $vector, '" or ', unpack("b*", $vector), "\n";


Expected result and result of the first run.
----------------------------------------------
0. Setbits are: 1
1. Setbits are: 2
2. Setbits are: 3
3. Setbits are: 4
4. Setbits are: 5
$vector is: "#031#" or 11111000

Result of the second and future runs until quit and relaunch of MacPerl.
------------------------------------------------------------------------
0. Setbits are: 0
1. Setbits are: 0
2. Setbits are: 0
3. Setbits are: 0
4. Setbits are: 0
$vector is: "#031#" or 11111000

--PGD