Hello all, this is my first post to this group, and I hope it isnıt
inappropriate. Anyway I have the following code in a CGI Iım working on,
itıs supposed to translate the ugly %(hexhex) markers for non-alphanumeric
characters back into normal text and assign the results to elements of an
array. In the following script $in has a sample line of form input to give
you a better idea of whatıs going on:

$in = 
"protocol=n&server=www.a.this%2Fis%2F%7Esilly.html&regex=babo%5Bd%7Ce%5D";
@in = split(/&/,$in);

foreach $inp (@in) {
    $inp =~ s/^.*=//;
    (@hxcodes) = ($inp =~ /\%(\w\w)/g);
    $nummatches = $#hxcodes + 1;
    if ($nummatches == 0) {
        print($inp,"\n");
        next;    
    } elsif ($nummatches > 0) {
        for ($i=0;$i <= $nummatches;$i++) {
        $trans{$hxcodes[$i]} = pack("C",hex($hxcodes[$i]));
        $inp =~ tr/%//d;
        $inp =~ s/$hxcodes[$i]/$trans{$hxcodes[$i]}/;
        }
    }
    print($inp,"\n");
    }

When I try this at home (on MacPerl) and at school (using standard Unix Perl
in OSX) the script works perfectly; however when I try to run it as a CGI on
the server (which is running Perl 5.006001) I get a blank page: presumably
the script is not generating any errors (at least according to the error
log), but it isnıt giving me any results either. Does anyone have any idea
why that might be? Also Iım a total novice at Perl, so please no rude
comments about my awkward coding (instructive comments about my awkward
coding would be more than welcome). Thanks in advance!

Ben
[EMAIL PROTECTED]
    

Reply via email to