in reply to Replacing strings

Well, we can make guesses at what you mean. But a little sample code like the following would allow us to answer your actual question rather than any one of the many we could invent for you.

use strict; use warnings; my $temp = 'Plugh'; my $str = <<STR; To %ad or not to %ad, that is the question. Oh %ad on you. STR $str =~ s/%ad/$temp/g; print $str;

Prints:

To Plugh or not to Plugh, that is the question. Oh Plugh on you.

If that isn't the answer to the question you were intending, please alter the sample code to illustrate what you really want to know. You ought to read I know what I mean. Why don't you? BTW. It was written for you.

Update: fix cut and paste problem


DWIM is Perl's answer to Gödel

Replies are listed 'Best First'.
Re^2: Replacing strings
by johngg (Canon) on Apr 25, 2006 at 22:44 UTC
    I guess you meant either

    my $temp = 'xyzzy';

    or

    To Plugh or not to Plugh. that is the question. Oh Plugh on you.

    Perhaps that should be "Oh plague on cut and paste" :-)

    Cheers,

    JohnGG

      Argh ...

      A plague on doing stuff in a hurry while the world is falling apart :)


      DWIM is Perl's answer to Gödel