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.

--
This does the same thing, but much faster:
$sum = unpack("%32C*", $string);
--
 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to