Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   Extracting some data from <% %> (http://www.velocityreviews.com/forums/t896511-extracting-some-data-from.html)

sonet 02-09-2006 08:09 AM

Extracting some data from <% %>
 

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;
}




usenet@DavidFilmer.com 02-09-2006 09:56 AM

Re: Extracting some data from <% %>
 
sonet wrote:
> 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?"

--
http://DavidFilmer.com



All times are GMT. The time now is 07:43 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.