sub checksum ($) { my $string = shift; my @chars = split //, $string; my $sum; $sum += $_ & 0x7F for (@chars[0..@chars-5]); # add ASCII values up $sum += hex(join('', @chars[@chars-4..@chars-1])); # add the last four characters interpreted as hex number return (($sum & 0xFFFF == 0) ? 0 : 1); }
In reply to Re: Conversion of C code to Perl-ese.
by CombatSquirrel
in thread Conversion of C code to Perl-ese.
by gooch
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |