develooper Front page | perl.perl5.porters | Postings from November 2000

5.6 bug: split /^/ implies /m modifier (from CLPM)

Thread Previous | Thread Next
Jeff Pinyan
November 27, 2000 05:32
5.6 bug: split /^/ implies /m modifier (from CLPM)
Message ID:
On comp.lang.perl.misc, the following code was found to work, rather
unexpectedly, in both 5.005_02 and 5.6:

  @lines = split /^/, "line\nwith\nnewlines\n";

That is, @lines becomes:

  ("line\n", "with\n", "newlines\n")

and the 'm' modifier isn't required.  This approach does NOT work with the
$ anchor (it requires the 'm' modifier).

Is this one of those special cases that isn't documented anywhere, or is
it a bug?

Jeff "japhy" Pinyan
CPAN - #1 Perl Resource  (my id:  PINYAN)
PerlMonks - An Online Perl Community
The Perl Archive - Articles, Forums, etc.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About