
ProBulletin
Novice
Jan 30, 2007, 1:53 PM
Views: 3416
|
|
Re: [seahorse] Help with an if regx statement
|
|
|
There are better ways than this but it is one way at least. Unless I've overlooked something simple it was trickier than it first appeared. my $open = 0; LOOP: while ($test =~ /(.)/g) { my $char = $1; if ($char eq '[' or $char eq ']') { $open = $char eq '[' ? 1 : 0; } else { if ($char eq ',' and $open == 0) { print "INVALID"; last LOOP; } } } Regards, Paul Wilson ProBulletin Board: http://www.probulletin.com/
(This post was edited by ProBulletin on Jan 30, 2007, 1:53 PM)
|