-   Programming (
-   -   Perl - Tpl file - Need to replace new line character. (

knnirmal 09-07-2004 12:29 PM

Perl - Tpl file - Need to replace new line character.
Hi, m brand new to Perl programming..

We have one .tpl file, which has code to read data from xml file and generate html using this data.

xml data has new line characters. We want to remove this new line character before generating html file.

Following is javascript code which is creating prob:

newdocument.write('<iw_value name='dcr.Important Information' />');

Here '<iw_value name='dcr.Important Information' />' returns string having new line character.

Cedrik 09-07-2004 12:41 PM

You can also use tr to delete one char :

cat xml_file.xml | tr -d '\n' >

or if the file is read line by line inside Perl script, just :
chop $line;

will do

knnirmal 09-07-2004 02:27 PM

Have found solution:

Following code works fine. Thanks to all of u..

my $str = iwpt_dcr_value( 'dcr.Important Information' );
$str =~ s/\n/<br \/>/g;
$str =~ s/\'/\\'/g;



All times are GMT -5. The time now is 12:44 PM.