S.A. Birl wrote:
> Given a bookmark:
> 
> <DT><A
> HREF="http://www.perl.com/CPAN-local/doc/FAQs/FAQ/PerlFAQ.html";
> ADD_DATE="897592292" LAST_VISIT="982769648" LAST_MODIFIED="982769648"
> ID="rdf:#$rsy5Z">PERL FAQ</A>   
> 
> 
> Wondering if it's possible to have 2 counters that would keep track
> of the 
> number of < and > encountered.
> 
> Im looking to see if there's a balance of < and >, and scream as soon
> as 
> there isnt a balance.
> 
> So given the above bookmark, I know that there's 3 <  and  3 >
> and the pattern is basically <><><> and not <<>> or >><, etc.

If you're specifically looking whether the brackets follow the pattern
<><><>, could you just do something like:

   my $brackets = join '', $bookmark =~ /[<>]/g;
   die "Bad pattern" unless $brackets eq '<><><>';

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to