RE: question on cook book example

2002-01-04 Thread Kipp, James
thanks jeff and marcus i found the doc i need in the unpack perldoc - thanks to marcus > -Original Message- > From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]] > Sent: Friday, January 04, 2002 1:21 PM > To: Kipp, James > Cc: Perl > Subject: Re: question on

Re: question on cook book example

2002-01-04 Thread Jeff 'japhy' Pinyan
On Jan 4, Kipp, James said: >buy not exactly sure how this is working. tried looking at perldoc pack >but no luck. explanation is appreciated. > >$sum = unpack("%32C*", $string); That is a 32-bit checksum (which means the sum is taken mod 2**32). It does what your loop did (summing the ASCII va

FW: question on cook book example

2002-01-04 Thread marcus_holland-moritz
| buy not exactly sure how this is working. tried looking at | perldoc pack | but no luck. explanation is appreciated. perldoc unpack gives the explanation: In addition to fields allowed in pack(), you may prefix a field with a % to indicate that you want a -bit checksum of the items inst

question on cook book example

2002-01-04 Thread Kipp, James
I understand how this works: --- $sum = 0; foreach $ascval (unpack("C*", $string)) { $sum += $ascval; } print "sum is $sum\n"; # prints "1248" if $string was "an apple a day" - buy not exactly sure how this is working. tried looking at perldoc pack but no luck. explanation is appreciated.