[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] 3 Questions and a Possible



3 Questions and a Possible Bug
I'm using MacPerl 5.1.0r2. I have three problems:

1. I have the following line of code in my script:
        $string =~ s/[^a-zA-Z_0-9\s]/unpack('c', $1)/eg;
   When I run it I get a bomb and have to restart my computer. Why?

2. I'm trying to take a string of characters, look for "special" characters 
and transliterate those special characters to &#XXX; strings for html. Any 
ideas on a clean way to do this. I have one solution that's (in my opinion 
ugly) but works; see following code:

        @a = unpack('C*', $string);
        for($i=0; $i < @a; $i++){
          $num = $a[$i];
          if($num < 32 || $num == 38 || $num == 60 || $num == 62 || 
          ($num >90 && $num < 97) || $num > 122){
            $a[$i] = "&$a[$i]\;";
           }else{
             $a[$i] = chr($a[$i]);
           }
         }
         $string = join('', @a);

3. Finally, I'm still having a problem with "requiring" my personal 
libraries. I still get a message of your library not found in @INC when I 
run a runtime compiled MacPerl script; alternatively if I run the same 
script as a non-runtime everything is ok. What gives?

Joseph Cozad
jcozad@oakhill.sps.mot.com