sub _checksum { my $data = _common_format shift; return unless defined $data; my @digits = split //, $data; my $sum = 0; foreach( reverse 2..10 ) { $sum += $_ * (shift @digits); } my $checksum = (11 - ($sum % 11))%11; $checksum = 'X' if $checksum == 10; return $checksum; }
Example 3: The Business::ISBN::_checksum routine.