Extracting some data from <% %>

S

sonet

I can extraceing data from <% %>.But how can i know how many times i need to
do?
Or have good method to complete this job?

#!/usr/bin/perl
use strict;
my $a=<<"HTML";
<html>
<body>
<%
template:datasrc=http://aaaa.com.tw/1.text

%>
12345
<%
template:datasrc=http://bbb.com.tw/2.text

%>
</body>
</html>

HTML
my $i=0;
while ($i++ < 2) {
print $1 if $a=~/<%(.*?)%>/sg;
}
 
U

usenet

sonet said:
I can extraceing data from <% %>.But how can i know how
many times i need to do?

Hmmmmm. I wonder if that type of question has ever been asked before.
In fact, I wonder if it is a "Frequently Asked Question."

Maybe it is. Have you looked at:
perldoc -q nesting
"How do I find matching/nesting anything?"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top