Mailing List Archive

Perl Script Question
Anybody know how to add "<br>" character at the end of every 5 th $rootid in
my script?

#Startin point
$headerfile = "message/headers/MSGS";
$rootfileid = "<95001>";

#End

"$headerfile" and "$rootfileid" value is already known with my script(having
value in advance).
These two $ is passed as STDIN from outside.

Contents of "MSGS" file is like this...

<START95001>
This is 1st line
<95001>
This is 2nd line
<95001>
This is 3 rd line
<95001>
This is 4 th line
<95001>
This is 5 th line
<95001>
<END95001>

first of all,this file having many of lines and could not know how many
lines deos it have.
Only one known thigs is including many blocks with...

<START#####>
<END#####>

style...
But ofcource including other randam lines....

So at this time,I have to write code with "land mark" like "<95001">.
First of all,I have to open "MSGS" then I have to use "<95001"> as unique
land mark and do SOMETHING but don`t have idea......

I want to add "<br>" character at the end of each 5 th "<95001>".

This is 5 th line
<95001>
<br>

then start to find next 5 th "<95001>".
if there are next 5 th( so 10 th in total),add "<br>" character at the end
of 10 th "<95001>".

This is 10 th line
<95001>
<br>

The script must be run a lot of time and the file "MSGS" glowing up time to
time...
So,if I run the script in the next time and "the first of 5 th <95001>" is
alrady having "<br>" character,I have to skip it.
"95001" is unique ID number and each block("<START#####>" to "<END#####>")
having its own unique number like "95002","95003" and so on...
And as I said before,this unique id number contained within $rootfileid.

I want to know how to do this with Win-NT Perl script...

1:open $headerfile
2:while appearing "<$rootfileid>"
3:define first "<$rootfileid>" to 5 th "<$rootfileid>"
4:When there is already "<br>" character at the next line of the end of
first 5 th "<$rootfileid>",skip it then start again from next
"<$rootfileid>" line
5:When the script find another 5 th "<$rootfileid>" without "<br>" character
at the next line of that $rootfileid,add "<br>" character
6:And repeat above.
7:When there are no "<$rootfileid>" anymore,stop the script.

I`m Japanese and can not speak English well.
Sorry to my bad English if I would confuse you.

Thank you.
Re: Perl Script Question [ In reply to ]
please take my name off your mailing lists.