Help for this page

Select Code to Download


  1. or download this
    sub getChecksum($) {
            my $in = shift;
    ...
            $in =~ m/(?:(.)(?{$check += ord($1);}))*^/;
            return $check;
    }
    
  2. or download this
    $in =~ m/(?:(.)(?{print "ASCII value of '$1' is: ".ord($1)."\n"; $chec
    +k += ord($1);}))*^/;
    
  3. or download this
    getChecksum called with: 'foo'
    ASCII value of 'f' is: 102
    ...
    ASCII value of 'o' is: 111
    ASCII value of 'o' is: 111
    will return '0'
    
  4. or download this
            my @chars = split( //, $in );
            foreach my $char (@chars) {
                    $check += ord($char);
            }