in reply to is (?: ... ) capturing
Capturing refers to data that is put into $1, $2, etc. or returned from a list context m//. You aren't using the result of a capture there, so capturing or not isn't relevant. Even though (?: ) doesn't capture, it does consume part of the string and usually becomes part of what s/// will replace. You can avoid that with a lookbehind instead: s/(?<=\s)\w/_/g. Or, in 5.10+, the \K feature: s/\s\K\w/_/g. See perlre for details.
--
A math joke: r = | |csc(θ)|+|sec(θ)|-||csc(θ)|-|sec(θ)|| |
Online Fortune Cookie Search
Office Space merchandise
A math joke: r = | |csc(θ)|+|sec(θ)|-||csc(θ)|-|sec(θ)|| |
Online Fortune Cookie Search
Office Space merchandise
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: is (?: ... ) capturing
by jeanluca (Deacon) on Sep 07, 2009 at 07:45 UTC | |
by ysth (Canon) on Sep 07, 2009 at 07:47 UTC | |
by ikegami (Patriarch) on Sep 07, 2009 at 09:30 UTC | |
by ysth (Canon) on Sep 07, 2009 at 17:18 UTC | |
by jeanluca (Deacon) on Sep 07, 2009 at 07:51 UTC |
In Section
Seekers of Perl Wisdom