>>>>> "RLS" == Randal L Schwartz <merlyn@stonehenge.com> writes: RLS> If that's the case, I see what you're doing, and you don't even need RLS> the x. :) RLS> $fmt =~ s/\G(\s*)(\S+\s*)/"x".length($1)."A".length($2)/ge; RLS> Every 'x' after the first will have 0. Interesting what constitutes defensive programming. :) Also interesting that your thinking works from the spaces to the data. Reminds me of those optical illusion drawings. What's foreground vs. background. Chaim> Why the \G ? RLS> Defensive programming, to ensure that I haven't coded the regex wrong RLS> and skip over data. This ensures that each new round begins where the RLS> previous round left off. This needs more explaination. How does a the regex go wrong yet the \G will keep it on track, and if it did go wrong aren't you in bad shape anyway? Once the regexp matches, and a substitution is done. Isn't there an implicit \G in there? Can the regexp backtrack behind the replacement? <chaim> -- Chaim Frenkel Nonlinear Knowledge, Inc. chaimf@pobox.com +1-718-236-0183 ==== Want to unsubscribe from Fun With Perl? ==== Well, if you insist... Send mail with body "unsubscribe" to ==== fwp-request@technofile.org