Re: Decimal representation of binary file (unpack)

2010-04-09 Thread Dr.Ruud
Raymond Wan wrote: Alan Haggai Alavi wrote: On 8 April 2010 11:00, Raymond Wan 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"; } Wildcards can be used within the template in pack. There is no

Re: Decimal representation of binary file (unpack)

2010-04-08 Thread Raymond Wan
Hi John/Philip, Thank you both for your comments -- I have to admit that this wasn't something that I thought about but it should have been. I'm sure as I progress, this would have been an annoying bug to locate... Thank you for saving me some stress! :-) Ray John W. Krahn wrote: Philip

Re: Decimal representation of binary file (unpack)

2010-04-08 Thread Alan Haggai Alavi
On 8 April 2010 11:00, Raymond Wan wrote: > > Hi all, > > I would like to read in a binary file and extract the 4-byte ints from it. >  Under Linux, something like "od -t uI".  I got it working as follows: > > > my $buffer = ; > my @buffer = split //, $buffer; > for (my $i = 0; $i < length ($buffe

Re: Decimal representation of binary file (unpack)

2010-04-08 Thread John W. Krahn
Philip Potter wrote: On 8 April 2010 06:30, Raymond Wan wrote: I would like to read in a binary file and extract the 4-byte ints from it. Under Linux, something like "od -t uI". I got it working as follows: my $buffer = ; my @buffer = split //, $buffer; for (my $i = 0; $i < length ($buffer

Re: Decimal representation of binary file (unpack)

2010-04-08 Thread Philip Potter
On 8 April 2010 06:30, Raymond Wan wrote: > > Hi all, > > I would like to read in a binary file and extract the 4-byte ints from it. >  Under Linux, something like "od -t uI".  I got it working as follows: > > > my $buffer = ; > my @buffer = split //, $buffer; > for (my $i = 0; $i < length ($buffe

Re: Decimal representation of binary file (unpack)

2010-04-07 Thread Raymond Wan
Hi Alan, Alan Haggai Alavi wrote: On 8 April 2010 11:00, Raymond Wan 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