Does Embperl use the variables $&, $`, $', $1, $2 etc for things other than 
pattern matching? I'm trying to take some text and find all occurances of a
 string in it and make those occurances in bold font, even if they are only part 
of a word (http://www.kvic.com/f.epl):

         [-
         $a = "Bill, make sure you take care of the billing and send Bill a 
bill";
         @words = split(/ /, $a);
         -]
         [$ foreach $word (@words) $]
                 [$ if $word =~ /bill/i $]
                         [+ $` +]<b>[+ $& +]</b>[+ "$' " +]
                 [$ else $]
                         [+ "$word " +]
                 [$ endif $]
         [$ endforeach $]

 This code outputs:

         make sure you take care of the and send a

 ... which means the pattern is getting matched, but $`, $& and $' have no 
values. When implimenting a standard (non-CGI) version of the above code:

         $a = "Bill, make sure you take care of the billing and send Bill a 
bill";
         @words = split(/ /, $a);

         foreach $word (@words)
         {
                 if($word =~ /bill/i)
                 {
                         print "$`<b>$&</b>$' ";
                 }
                 else
                 {
                         print "$word ";
                 }
         }

 ... it outputs my desired result:

         <b>Bill</b>, make sure you take care of the <b>bill</b>ing and send 
<b>Bill</b> a <b>bill</b>

 Anyone know what Embperl does with these special variables?

- Gavin

"People are the worst drivers in the world" 
http://www.singlespeedsanonymous.com/

Join PayPal and get FIVE FREE DOLLARS (no joke!):
https://secure.paypal.x.com/refer/pal=gavinspomer%40hotmail.com
... and it's a very usefull account to have!




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to