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

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

Thread Previous | Thread Next
From:
Jeff Pinyan
Date:
November 27, 2000 05:32
Subject:
5.6 bug: split /^/ implies /m modifier (from CLPM)
Message ID:
Pine.GSO.4.21.0011270826080.2522-100000@crusoe.crusoe.net
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     japhy@pobox.com    http://www.pobox.com/~japhy/
CPAN - #1 Perl Resource  (my id:  PINYAN)       http://search.cpan.org/
PerlMonks - An Online Perl Community          http://www.perlmonks.com/
The Perl Archive - Articles, Forums, etc.   http://www.perlarchive.com/


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About