Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl -w
    use strict;
    ...
    #...snipped out the original checkUPC here to save space...
    print &checkUPC("142687305632"), "\n";
    print &checkUPCrobot("142687305632"), "\n";
    
  2. or download this
    # returns error message on failure, undefined value on success
    sub checkUPCrobot2
    ...
      my $chk2 = 10 - ($mult%10);
      return "invalid checkdigit...should be $chk2" if $check!=$chk2;
    }