Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Replacing strings

by perl_99_monk (Novice)
on Apr 25, 2006 at 20:14 UTC ( [id://545633]=perlquestion: print w/replies, xml ) Need Help??

perl_99_monk has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Replacing strings
by GrandFather (Saint) on Apr 25, 2006 at 21:02 UTC

    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
      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
Re: Replacing strings
by Tanktalus (Canon) on Apr 25, 2006 at 20:32 UTC
    $var =~ s/%ad/$temp/g

    What did you try?

Re: Replacing strings
by SamCG (Hermit) on Apr 25, 2006 at 20:52 UTC
    I suggest this node on asking questions effectively. Unless tanktalus really has hit on your basic issue, in which case, congratulations on your economy of means (though I still think you'd be well-served by making your question more explicit).



    -----------------
    s''limp';@p=split '!','n!h!p!';s,m,s,;$s=y;$c=slice @p1;so brutally;d;$n=reverse;$c=$s**$#p;print(''.$c^chop($n))while($c/=$#p)>=1;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://545633]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (8)
As of 2024-04-23 11:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found