[Melbourne-pm] Extracting a parenthesized fragment from a string
daniel at rimspace.net
Fri Sep 11 20:22:21 PDT 2009
"Timothy S. Nelson" <wayland at wayland.id.au> writes:
> On Fri, 11 Sep 2009, Sam Watkins wrote:
>> On Fri, Sep 11, 2009 at 07:05:45PM +1000, Robert Norris wrote:
>>> So, what's wrong here? And is there an easier way to do this? Note that
>>> I'm restricted to Perl 5.6, which sucks as I'd really like to try the
>>> PARNO stuff that came with 5.10.
>> I think normal regexps aren't the right tool for this, you can do it
>> easily in a couple of lines of C, but that method would be somewhat slow
>> in perl. But given that you're dealing with IMAP, the network is going
>> to be a lot slower, so you might as well just do it with a for loop over
>> the characters and count parentheses, rather than some totally obscure
>> regexp hack.
> Incidentally, this is something that Perl 6 will solve. Because it has
> grammars. You could use Parse::RecDescent and an IMAP grammar, but that
> would be overkill in a P5 situation. P6 on the other hand... :).
I am curious why you say that using Parse::RecDescent is wrong with Perl5?
I consider it likely to be more work than is strictly needed, and perhaps
difficult to feed a protocol stream rather than a complete text, into, but
I can't see why it would be any less right than in Perl6.
Do you mind explaining further? You obviously see something I don't, and
I would love to understand what. :)
✣ Daniel Pittman ✉ daniel at rimspace.net ☎ +61 401 155 707
♽ made with 100 percent post-consumer electrons
Looking for work? Love Perl? In Melbourne, Australia? We are hiring.
More information about the Melbourne-pm