Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

inserting text into file

Status
Not open for further replies.

jamsman

Technical User
Jul 22, 2005
38
DE
i have loaded an xml file into my perl script i now need to enter in a new line of information into the second line of the file is this possible if so how

thank you
 
Hi jamsman

As Trojan points out - this is very vague

Can you be more specific - and maybe post the first few lines of the XML file?


Kind Regards
Duncan
 
sorry for the vagueness,
the xml file is a result of a call to a database. the rsult is being stored in a scaler.

the xml file starts:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Export Data
Database:DDTS
Query:"Public Queries/Projects/JamesWhite/James_DTs"
Date: 2005-07-28 11:41:26
-->
<APPLICATION>ARTSPlus
.......
and then the rest of the tags are here

hope this helps

 
Code:
[b]#!/usr/bin/perl[/b]

undef $/;
$_ = <DATA>;
$/ = "\n";

s/(.*)/$1\n      NEW LINE HERE/;

print;

__DATA__
<?xml version="1.0" encoding="ISO-8859-1"?>
      <!--
       Export Data
       Database:DDTS
       Query:"Public Queries/Projects/JamesWhite/James_DTs"
       Date: 2005-07-28 11:41:26
       -->
      <APPLICATION>ARTSPlus

???


Kind Regards
Duncan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top