473,804 Members | 3,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Perl "test merge"


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 !!$someperlvari able!!

more text"

and if $someperlvariab le = "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 $someperlvariab le)

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

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

Jul 19 '05 #1
2 2512

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

Jul 19 '05 #2

D'OH!

Text::Template was what I was looking for

Sorry for the newbie question/s

--
Joe Cosby
http://joecosby.com/
EMBRACE the SUCKINESS

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3914
by: Sean Dettrick | last post by:
Hi, I have several <vector>'s of the same length, with entries as follows: I= A= B= I want to use STL to make (I == 0) a mask to operate on the elements of A and B, i.e. I want to do this:
3
4596
by: anurag | last post by:
Hi, Is "MERGE INTO..." statement allowed to be executed in a dynamic SQL statement, inside an SQL Stored Procedure? I am using DB2 UDB 8.1.2 on Windows. If it is not allowed (as I suspect), how do I go about converting an Oracle Procedure that dynamically executes "MERGE INTO..."? ONE RESTRICTION: My converted code has to execute faster than the Oracle SP (everything else being the same).
1
2443
by: mcmreddy | last post by:
Hello, Is there any advantage of using "MERGE INTO" SQL instead of using "EXISTS" AND "NOT EXISTS" in DB2?. Thanks, --Chandra
5
3329
by: Janick Bernet | last post by:
I'm going crazy trying to write a working merge-statement. Why doesn't the following work: MERGE INTO utSystem.t_Filter_Results AS Res USING (SELECT 9 as clubid, 50 as filterid, ID as MemberID FROM club.vc_9 WHERE (("LOCATION#" = 'Zürich')) AND (ENTERING_DATE <= CURRENT DATE) AND ((LEAVING_DATE > CURRENT DATE) OR (LEAVING_DATE IS NULL))
3
1793
by: MirzaSila | last post by:
I am using mail merge option in msWord for creating labels, data source is msAccess. Problem is when I choose option "merge to printer" it only prints the curent page even though I completed the merge.I'am not sure is it printer proporties causing the problem or something else? Any reply would be appreciated.
2
3305
by: john sun | last post by:
Hi, Dear gurus, In the web deployment project, there is one option called "Output Assemblies page". The first choice is "Merge all outputs to a single assembly", According to MSDN, "Merges all the output assemblies from the compiler into a single assembly. This setting is equivalent to the -o assemblyname option of
0
1589
by: Quisbamsis | last post by:
Access Database Merge to Publisher or Word. Everytime I run a "Mail and Catalogue Merge Wizard" in Publisher or Word and I get to the "Mail Merge Recipients" dialogue box, my edit button is deselected, and I can't make any edits to the selected Access database. I have to close out of Publisher, and launch my Access database with the recipient information and make all edits through Access. This is a pain. Please help. Quisbamsis.
0
1616
by: lamagra | last post by:
Hello all, I first wanted to say that this is my first post and thank you for taking a look at it. My question: I am trying to write an XML Parser using the Lib:XML package. The problem that I am having is that I seem to not be able to parse the a "local name" searching for an xsi:type="test". Here is an example of what I am looking for.
5
16708
by: Mark Chambers | last post by:
Hi there, Can anyone explain the following (very) simple scenario. 1) I make an exact copy of my "DataSet" and delete one record from a given table (in the copy) 2) I invoke "DataSet.GetChanges()" on the above copy and pass the results to "DataSet.Merge()" on the original copy 3) If I now inspect the original copy, it shows that the record has *not* been deleted from the table. However, a call to "GetChanges()" does show my
0
9707
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9585
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10586
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10082
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7622
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5658
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2997
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.