in reply to Search and Replace

getting shorter...
s#\([^)]+\)#$_=$&;y/;/,/;$_#ge
(thanks turnstep, i added 'g'. duh!)

(also, as le says below, it isn't a good idea to use $& in production code)

Replies are listed 'Best First'.
RE: Re: Search and Replace
by le (Friar) on Jul 19, 2000 at 20:33 UTC
    I wouldn't use (and recommend using) $&, because of efficiency reasons. "Mastering Regular Expressions" explains why.
      thanks. i'm aware of that, but i was only interested in shortening the s///. i've read Mastering Regular Expression cover-to-cover. i can't say that i've actually ever used $& in any Perl code i've written, since i read MRE very early in my Perl days (right after Effective Perl Programming) and took the warning you're reiterating here to heart.