From: Paul Lalli on
Dr.Ruud wrote:
> Gunnar Hjalmarsson schreef:
> > Note that the /s modifier is redundant (see "perldoc perlre").
>
> I don't consider the /s modifier redundant. It was not needed in my
> example, so maybe you meant "redundant here"?

Redundant would be if you had something in your pattern match like:
/stuff(?:.|\n)stuff/s

Here, I think /s is simply extraneous.

Paul Lalli

From: Gunnar Hjalmarsson on
Dr.Ruud wrote:
> Gunnar Hjalmarsson schreef:
>>Note that the /s modifier is redundant (see "perldoc perlre").
>
> I don't consider the /s modifier redundant. It was not needed in my
> example, so maybe you meant "redundant here"?

Okay, redundant (or extraneous...) here. I mentioned it because people
misunderstand the meaning of it all the time, and I believe one reason
for that is that "perldoc perlre" - unlike e.g. "perldoc perlop" - is
the only place in the docs (to my knowledge) where its meaning is
properly explained.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
From: Abigail on
Gunnar Hjalmarsson (noreply(a)gunnar.cc) wrote on MMMMCDXLVI September
MCMXCIII in <URL:news:3ss54cFpe3koU1(a)individual.net>:
** Dr.Ruud wrote:
** > Gunnar Hjalmarsson schreef:
** >>Note that the /s modifier is redundant (see "perldoc perlre").
** >
** > I don't consider the /s modifier redundant. It was not needed in my
** > example, so maybe you meant "redundant here"?
**
** Okay, redundant (or extraneous...) here. I mentioned it because people
** misunderstand the meaning of it all the time, and I believe one reason
** for that is that "perldoc perlre" - unlike e.g. "perldoc perlop" - is
** the only place in the docs (to my knowledge) where its meaning is
** properly explained.


Damian makes a good argument in PBP to always use /s and /m.

I don't think it's worth raising your finger if someone uses /s or /m
on a regex where it doesn't matter. It's like complaining someone uses
'use warnings' on a piece of code where it didn't matter.



Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
From: Dr.Ruud on
Anno Siegel schreef:

> The changes by /x only affect the regex proper. The replacement part
> is still an ordinary double-quotish string.

OK. I am still trying to think up why it was chosen to not affect the
replacement part. I have no doubt that there is a simple explanation why
it is not feasible, but I just can't think it up (tired of working some
very long days, but very satisfied with the results and very happy with
Perl).

--
Affijn, Ruud

"Gewoon is een tijger."

From: Gunnar Hjalmarsson on
Abigail wrote:
> Gunnar Hjalmarsson (noreply(a)gunnar.cc) wrote on MMMMCDXLVI September
> MCMXCIII in <URL:news:3ss54cFpe3koU1(a)individual.net>:
> ** Dr.Ruud wrote:
> ** > I don't consider the /s modifier redundant. It was not needed in my
> ** > example, so maybe you meant "redundant here"?
> **
> ** Okay, redundant (or extraneous...) here. I mentioned it because people
> ** misunderstand the meaning of it all the time, and I believe one reason
> ** for that is that "perldoc perlre" - unlike e.g. "perldoc perlop" - is
> ** the only place in the docs (to my knowledge) where its meaning is
> ** properly explained.
>
> Damian makes a good argument in PBP to always use /s and /m.

What's PBP?

> I don't think it's worth raising your finger if someone uses /s or /m
> on a regex where it doesn't matter. It's like complaining someone uses
> 'use warnings' on a piece of code where it didn't matter.

A better parallel IMO is that it's like complaining when someone calls a
function using '&' without knowing the implications of doing so. It
'works' most of the time, but not always...
(Not saying that Dr. Ruud doesn't know the implications of using the /s
modifier. It's now obvious that he does.)

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6
Prev: Perl gethostbyname
Next: How to Remove Space in text file