On Thu, 28 Sep 2000 23:54:20 +0100, Hugo wrote: >I still like the idea of $$, as I described it in the original thread. >I've seen no comments for or against at this time. I intend to put this in the RFC: Hugo prefers to add an alternative, like /$$/, wich would behave like this. But an alternative already exists: /\z/. We don't want Yet Another Alternative. We want to fix /$/ so that it will Do The Right Thing. >:=head2 Getting the old behaviour back >: >:You can't. Question is: do you really want to? >: >:=head1 MIGRATION >: >:It's not unlikely that currently having /$/ in your regexes, is actually >:a bug in your script, but you don't care because the data won't ever >:make it visible. >This seems like a read bad idea. I think you have to assume people >are feeding you the code they want to run. I'll replace relavant parts of the RFC with this: =head2 '/z/' and '/Z' /\z/ and /\Z/ will not be altered. They will still behave as before. =head1 MIGRATION replace /$/s with /\Z/s. The behaviour of /\Z/ will not be altered. >:=head2 '/ms': combined '/m' and '/s' >: >:'/ms' still works as before. Internally, '/m' has taken over the job of >:matching before a newline at the end of the string, simply because /$/m >:can match before I<every> newline. > >Eh? Surely /$/ms would now only match _after_ the newline, or at end of >string, whereas before it would match before _or_ after any newline, or >at end of string? My gut feeling tells me this just ain't right. /$/m is supposed to match at the end of any line (or at the end of the string). The "end of line" is before the newline, not after it. Perl5 agrees with me: $_ = "foo\nbar\nbaz\n"; if(/^bar\n$/m) { print "'/\$/m' matches follwoing a newline\n"; } else { print "'/\$/m' does not match following just any newline\n"; } if(/^bar$/m) { print "'/\$/m' matches just before any newline\n"; } else { print "'/\$/m' does not match before just any newline\n"; } --> '/$/m' does not match following just any newline '/$/m' matches just before any newline The meaning of the term "end of line" won't change because of the the '/s'. So, I expect that under '/ms', /$/ can match before any newline thanks to the '/m', and '/s' will make /./ match any newline. -- Bart.