[EMAIL PROTECTED] wrote:
>         I have a  script that reads text from a  file and inserts text
> into different  places depending on  what it needs  to do.  But  I use
> split to replace the text, i.e.:
> 
> ($first_part, $second_part) = split "#INSERT#TEXT#HERE#", $document,
> 2; print FILEHANDLE $firstpart, $text_to_insert, $secondpart;
> 
>         Is  there a  replace function  in perl  that would  let  me do
> something like  replace "#INSERT#TEXT#HERE", $text_to_insert;?   I was
> going to  write my own  method but was  curious if perl  had something
> faster?
> 
> Thanks in advance,
> 
> -Dan

        You should be able to use a regex(assuming the data you are looking for is in  
$_):

        if ( s/#INSERT#TEXT#HERE#/$text_to_insert/ ) {
                # success
       }else {
                # no hit

       }

Wags ;)


**********************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
****************************************************************


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to