Hi
I am in process of creating a template Say a HTML template...pasting one sample line
below.
<td width="1" bgcolor="#[%topColor%]"><img border="0"
src="[%1x1_image%]" width="1" height="100%"></td>
and there is one text file(config.txt) has several entries
1x1_image=/images/temp_white.gif
topColor=FFFFFF
The problem is when I ryun the perl script it has to identify that topColor and
1x1_image are not varaibles which need to be taken from the file called config text
and the output shld produce as, in the sense nothing shld be hardcoded.
<td width="1" bgcolor="#FFFFFF"><img border="0"
src="images/temp_white.gif" width="1" height="100%"></td>
Wrote a script which checks this, Assume the template file is stored line by line in
an array named "data", recordCount1 is the total number of lines in the source file.
$openTag='\[%' ;
$closeTag='%\]' ;
for($m=0;$m<$recordCount1;$m++)
{
$_=$data[$m];
if($_ =~ /$openTag.*$closeTag/)
{
#Enters wherever it find [% the pattern
print "Line Number where the substition is needed is
$m";
}
}
My Question- Iwanted to print the pattern say topColor,1x1_image. and if there are two
variables in a single line it should print both...Is that possble to take the regular
expression.....
Thanks
Anish