Hi Alan,


Alan Haggai Alavi wrote:
On 8 April 2010 11:00, Raymond Wan <r....@aist.go.jp> wrote:
for (my $i = 0; $i < length ($buffer); $i += 4) {
 print unpack ('I', $buffer[$i].$buffer[$i + 1].$buffer[$i + 2].$buffer[$i +
3]), "\n";
}
Hi Raymond,

Wildcards can be used within the template in pack. There is no need of
the inner loop you have written. For example, to unpack all signed
longs:

my @signed_longs = unpack ( 'I*', $buffer );


Ah!  Wildcards...never saw that one coming...  I presumed I was just 
misunderstanding the perldocs.

Thank you!  Exactly what I was looking for!

Ray


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to