Dwood has asked for the wisdom of the Perl Monks concerning the following question:
Any thoughts on how to implement such parsing methods without regex (is that even possible?)sub parenth { my ($string) = (@_); my $l_count = () = ($string =~ /\(/g); my $r_count = () = ($string =~ /\)/g); if ($l_count != $r_count) { print "There is no balance on this line! Did you format it + correctly???"; return 0; } else { print "There is balance in this universe"; return 1; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: IT's not counting...
by samarzone (Pilgrim) on Nov 16, 2010 at 07:25 UTC | |
by Dwood (Acolyte) on Nov 16, 2010 at 08:47 UTC | |
by samarzone (Pilgrim) on Nov 16, 2010 at 09:28 UTC | |
by Dwood (Acolyte) on Nov 16, 2010 at 09:47 UTC | |
|
Re: IT's not counting...
by jwkrahn (Abbot) on Nov 16, 2010 at 07:26 UTC | |
by mjscott2702 (Pilgrim) on Nov 16, 2010 at 08:46 UTC | |
by johngg (Canon) on Nov 16, 2010 at 15:30 UTC | |
by jwkrahn (Abbot) on Nov 16, 2010 at 15:12 UTC | |
by Dwood (Acolyte) on Nov 16, 2010 at 08:59 UTC | |
by JavaFan (Canon) on Nov 16, 2010 at 11:05 UTC |