> Papo Napolitano wrote:
> > Charles Farinella wrote:
> >>
> >>$text =~ s/\r\n/<br>/g;
> >>
> >>doesn't work.
> >
> > $text =~ s/\r\n/<br>/gs;
> ------------------------^
>
> Why would the /s modifier make a difference? Please study
>
>      perldoc perlre
>
> and figure out why it doesn't. ;-)

perl -e '$_ = "line1\r\nline2\r\n\r\nline4"; s/\r\n/<br>/gs; print'

Please test, and figure out why it DOES make a difference.
Also study what "perldoc perlop" has to say about s///.
Look for "s/PATTERN/REPLACEMENT/egimosx" and especially the description of
the "s" modifier.
As you may know s/// only matches to the end of line (And "\r\n" happens to
be a line delimiter) unless you use the /s modifier.

;-)


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to