Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: replacing part of a string

by radiantmatrix (Parson)
on May 13, 2009 at 15:48 UTC ( #763805=note: print w/ replies, xml ) Need Help??


in reply to replacing part of a string

Hm, think about it this way:

open my $FILE, '<', $name_of_file_with_functions_in_it or die ("Crap: +$!"); while (<$FILE>) { s/\bC\b/$z/g; # replace the *word* "C" with the contents of $z print $_; } close $FILE;

This prints the output to STDOUT

If you want to replace 'C' with the literal string '$z', then you just have to escape the $ in the above (\$z).

<radiant.matrix>
Ramblings and references
“A positive attitude may not solve all your problems, but it will annoy enough people to make it worth the effort.” Herm Albright
I haven't found a problem yet that can't be solved by a well-placed trebuchet


Comment on Re: replacing part of a string
Select or Download Code
Re^2: replacing part of a string
by Anonymous Monk on May 14, 2009 at 04:28 UTC
    Hey!!! Its Working thanx!!! monks... :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://763805]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2015-07-02 04:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (27 votes), past polls