http://qs321.pair.com?node_id=11141559


in reply to Re: unpack into arrayrefs?
in thread unpack into arrayrefs?

That is a nice approach.

I was in a hurry, so went for a quick substr approach:

push @a, [ unpack "CCSS", substr($data, $_ * 6, 6) ] for 0..(length($data) / 6 - 1);

Had an off-by-one error at first though. Perl doesn't seem to have a range operator that goes up to n-1, like Ruby does? (0..5 loops from 0 to 5 but 0...5 loops from 0 to 4 in Ruby)