
timewaves
New User
Sep 14, 2010, 8:57 AM
Post #1 of 2
(1361 views)
|
|
Matching right and left paranthesis in a long string
|
Can't Post
|
|
Hi, the title should say it all the code I currently have is:
my @right_p = $tree =~ /(\()/g; my @left_p = $tree =~ /(\))/g; print $#right_p == $#left_p ? "YES\n" : "NO\n"; Is there any way of circumventing the use of these two arrays, and truncating this block into one line perhaps? I have tried comparing both regexs directly but it just compares "1" instead. Thanks in advance!
|