in any case, i think we have a fair agreement on rfc 158 and i will
freeze it if there is no further comments on it.
I think you should remove the parts of your propsal about making $ be
autolocalized.
If you're not planning to revise your RFC, let me know so that I can
ask the
(mystery: how
can filling in $ be a lot slower than filling in $1?)
It isn't. It's the same. $1 might even be more expensive than $.
It appears that many people don't understand the problem with $. I
will try to explain.
Maintaining the information required by $1 or $ slows down the
Jonathan Scott Duff wrote:
How about something like this?
$re = qr/(\d\d)-(\d\d)-(\d\d)/g;
$re-onmatch_callback(push @list, makedate(^0,^1,^2));
$string =~ $re;
It's not bad, but it loses one thing that I was trying to keep from the
SNOBOL model. If you have (again,
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
On Tue, 29 Aug 2000 08:51:29 -0400, Mark-Jason Dominus wrote:
There are many operations that would be simpler if there was
a magic array that contained ($1, $2, $3, ...). If anyone wants to
write an RFC on this, I will help.
Heh. I once complained about the lack of such an array, in
That empty list to force the proper context irks me. How about a
modifier to the RE that forces it (this would solve the "counting matches"
problem too).
$string =~ m{
(\d\d) - (\d\d) - (\d\d)
(?{ push @dates, makedate($1,$2,$3) })
}gxl;
$count =
p.s. Has anybody already suggested that we ought to have a nicer
solution to execute perl code inside a string, replacing "${\(...)}" and
"@{[...]}", which also won't ever win a beauty contest? Oops, wrong
mailing list.
The first one doesn't work, and never did. You want
@{[]} and
Have you ever wanted to count the number of matches of a patten? s///g
returns the number of matches it finds. m//g just returns 1 for matching.
Counts can be made using s//$/g but this is wastefull, or by putting some
counting loop round a m//g. But this all seams rather messy.
It's