Help for this page

Select Code to Download


  1. or download this
    sub checkUPCGrandFather2 {
        my $str = shift;
    ...
        # return error message if wrong check digit was initially given
        return ($check != substr $str, 11) ? "invalid checkdigit...should 
    +be $check" : 'Ok';
    }
    
  2. or download this
    checkUPCGrandFather1: invalid checkdigit...should be 6
    checkUPCGrandFather2: invalid checkdigit...should be 6
    ...
    EvanK        24183/s          12%           --          -9%         -6
    +9%
    roboticus    26595/s          23%          10%           --         -6
    +5%
    GrandFather2 76965/s         256%         218%         189%           
    +--
    
  3. or download this
    use warnings;
    use strict;
    ...
        # return error message if wrong check digit was initially given
        return ($check != substr $str, 11) ? "invalid checkdigit...should 
    +be $check" : 'Ok';
    }