>>>>> "JSD" == Jonathan Scott Duff <[EMAIL PROTECTED]> writes:
JSD> To bring this back to perl6, autrijus' original query was regarding
JSD> $ pugs -e 'say join ",", split /(..)*/, 1234567890'
JSD> which currently generates a list of ('','12','34','56','78','90')
JSD> In perl5 it would generate a list of ('','90') because only the last
JSD> pair of characters matched is kept (such is the nature of quantifiers
JSD> applied to capturing parens). But in perl6 quantified captures put all
JSD> of the matches into an array such that "abcdef" ~~ /(..)*/ will make
JSD> $0 = ['ab','cd','ef'].
JSD> I think that the above split should generate a list like this:
JSD> ('', [ '12','34','56','78','90'])
i disagree. if you want complex tree results, use a rule. split is for
creating a single list of elements from a string. it is better keep
split simple for it is commonly used in this domain. tree results are
more for real parsing (which split is not intended to do) so use a
parsing rule for that.
also note the coding style rule (i think randal created it) which is to
use split when you want to throw things away (the delimiters) and m//
when you want to keep thinks.
uri
--
Uri Guttman ------ [EMAIL PROTECTED] -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org