in reply to Re: Trying to avoid line noise (brain cramp)
in thread Trying to avoid line noise (brain cramp)

I like your code, but there's a small error:
# original: /([^(]+)(\([^)]+\))(.*)/ my $not_paren = "[^(]+"; my $leftparen = "\\("; my $rightparen = "\\)"; my $rest = ".*"; # now reads: $string =~ /($not_paren)($leftparen$not_paren$rightparen)($rest)/;

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

Replies are listed 'Best First'.
Re: Re: Re: Trying to avoid line noise (brain cramp)
by clemburg (Curate) on Mar 09, 2001 at 18:47 UTC

    Ah, yes, sorry. So much for not testing everything.

    Christian Lemburg
    Brainbench MVP for Perl
    http://www.brainbench.com

Re: Re: Re: Trying to avoid line noise (brain cramp)
by frag (Hermit) on Mar 09, 2001 at 20:51 UTC
    Here's one more way to de-line-noise-ify the code:
    my $leftparen = quotemeta "("; my $rightparen = quotemeta ")";
    This is more legible than "\\(" or "\Q(\E". -- Frag.