Perl "test merge"

J

Joe Cosby

Thanks for all the help with the earlier questions I've posted

I am trying to do something I've seen in other perl code bases but I
don't know how they do it.

You have a text -file- (html, usually) and it looks like this:

"Some text

Some more text !!$someperlvariable!!

more text"

and if $someperlvariable = "merge stuff" you end up with

"Some text

Some more text merge stuff

more text"

Now the point is, this should work for any variable defined in the
parent code, not just the one particular one. (Obviously it would be
easy if the only variable I had to worry about was $someperlvariable)

If I define a string in perl as "some text $someperlvariable more
text" then perl does what I want, the value of $someperlvariable goes
into the string rather than "$someperlvariable".

But if I load the string from a file this doesn't seem to work.

It seems to be at least a somewhat common practice (using the double
"!!" or other delimiters to indicate dynamic content to be merged in),
it seems like I've seen it done in other code bases than the one I
first saw it in.

Does anybody know how to do this?

--
Joe Cosby
http://joecosby.com/
Summoning his cosmic powers
and blowing slightly from his toes
the psychic emanations flow
- Syd Barret
 
J

Joe Cosby

oops, that should have been "text merge"



--
Joe Cosby
http://joecosby.com/
"So is it like a tree that falls in the forest with nobody there to hear it?"
"I feel sorry for that tree" said Carter

- Glen Gold
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

How to sort a CSV file with merge sort JAVA 7
Merge files 1
Nan values after merging 2 dataframes 1
building generators in Perl 1
Merge strategy 2
Merge collections of objects 11
mail merge? 4
TF-IDF 1

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top