Help for this page

Select Code to Download


  1. or download this
    my $result = 0;
    for my $i ( 0 .. length( $str ) - 1 ) {
        $result += ord( substr $str, $i, 1 ) * 3 / 4;
    }
    return $result;
    
  2. or download this
    my $pdl = PDL split '', $str;
    my $result = sum( $pdl * 3 / 4 );