On Aug 13, ERIC Lawson - x52010 said:
>It does change every instance (except the first) of \n%A in the scalar
>into a semicolon, given a scalar containing, e.g.,
Basically, it scrunches
%A this
%A that
%A those
into
%A this;that;those
>My concern is with how it works...not understanding how, I'm expecting
>surprises when I attempt to use the same tactic in other contexts.
The inversion is probably what scares you.
1 while EXPR;
is a technique to evaluate EXPR until it becomes false. You could write
it as
while (EXPR) { 1 }
or
while (1) {
last if !EXPR;
}
The point is, the regex advances PAST the next %A, so in the text
%A this
%A that
%A those
just executing the regex
s/(%A .*)\n%A /$1;/g
would result in
%A this;that
%A those
However, I have a solution, that I'll be posting in a moment.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Re: how does "1 while $scalar =~ s/(%A .*)\n%A /$1\;/g;" work?
Jeff 'japhy/Marillion' Pinyan Mon, 13 Aug 2001 08:55:14 -0700
- how does "1 while $scalar =~ s/(%A .*)\... ERIC Lawson - x52010
- Re: how does "1 while $scalar =~ s... Jeff 'japhy/Marillion' Pinyan
- Re: how does "1 while $scalar =~ s... Jeff 'japhy/Marillion' Pinyan
- Re: how does "1 while $scalar =~ s... ERIC Lawson - x52010
- Re: how does "1 while $scalar ... Jeff 'japhy/Marillion' Pinyan
