Correction: "$strings" in the if statement should be "$string"

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 27, 2004 4:04 PM
To: [EMAIL PROTECTED]
Subject: RE: Recursively counting a matching pattern on a single line.


Great!  That works.  But I was looking to get a little trickier with it.


----------------

If you want to make sure they are alternating like <><><> etc... I would do
this:

$_ = $line;

@syms = m/[<>]/g;
$string = join("", @syms);
if ($strings !~ m/^<(><)*>$/)
{
        ## Scream here!
}

The regular expression:

m/^<(><)*>$/

will ensure that it starts with < and ends with > and anything in between
will be "><" which I think should do the trick. That logic is pretty hairy
though and I could be missing something.

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


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