On Mon, 28 Aug 2000, Mark-Jason Dominus wrote:
> But there is no convenient way to run the loop once for each date and
> split the dates into pieces:
>
> # WRONG
> while (($mo, $dy, $yr) = ($string =~ /\d\d-\d\d-\d\d/g)) {
> ...
> }
What I use in a script of mine is:
while ($string =~ /(\d\d)-(\d\d)-(\d\d)/g) {
($mo, $dy, $yr) = ($1, $2, $3);
}
Although this, of course, also requires that you know the number of
backreferences. Nicer would be to be able to assign from @matchdata or
something like that :)
Cheers,
Philip
--
Philip Newton <[EMAIL PROTECTED]>
- RFC 110 (v3) counting matches Perl6 RFC Librarian
- Re: RFC 110 (v3) counting matches Jonathan Scott Duff
- Re: RFC 110 (v3) counting matches Tom Christiansen
- Re: RFC 110 (v3) counting matches Jarkko Hietaniemi
- Re: RFC 110 (v3) counting matches Jarkko Hietaniemi
- Re: RFC 110 (v3) counting matches Mark-Jason Dominus
- Re: RFC 110 (v3) counting matches Nathan Wiger
- Re: RFC 110 (v3) counting matche... Mark-Jason Dominus
- Re: RFC 110 (v3) counting matches Damien Neil
- Re: RFC 110 (v3) counting matche... Mark-Jason Dominus
- Re: RFC 110 (v3) counting matches Philip Newton
- Re: RFC 110 (v3) counting matche... Mark-Jason Dominus
- Re: RFC 110 (v3) counting ma... Bart Lateur
- Re: RFC 110 (v3) countin... Mark-Jason Dominus
- $& and copying: rfc ... Uri Guttman
- Re: $& and copying: ... Mark-Jason Dominus
- Re: $& and copying: ... Tom Christiansen
- Re: $& and copying: ... Mark-Jason Dominus
- Re: $& and copying: ... Mark-Jason Dominus
- Re: RFC 110 (v3) counting matche... Joe McMahon
- Re: RFC 110 (v3) counting ma... Tom Christiansen
