in reply to Simple query regarding unpack/splice

How many elements has @datapoints after the while loop? I don't know if there are more errors, but maybe one problem is in the line:

@datapoint = splice(@values, 0, $x);

After the while loop @datapoint will only have the last value unpacked, you should use push @datapoint, splice(@values,0,$x) instead

Also, taking into account that unpack called in scalar context returns only the first element unpacked, you can just simply write

push @datapoint, unpack ("V",$buf)

Update (thanks to moritz):

push @datapoint, scalar unpack ("V",$buf)

Hope this helps

citromatik

Replies are listed 'Best First'.
Re^2: Simple query regarding unpack/splice
by moritz (Cardinal) on May 08, 2008 at 16:19 UTC
    But push provides list context onto its arguments.
Re^2: Simple query regarding unpack/splice
by sf_ashley (Sexton) on May 08, 2008 at 16:37 UTC
    Thanks for your suggestions regarding this matter citromatik. Indeed, by using push, the problem was fixed.