develooper Front page | perl.perl5.porters | Postings from January 2001

Bug with -p in 5.6, 5.7

Ben Tilly
January 11, 2001 18:06
Bug with -p in 5.6, 5.7
Message ID:
The following one-liner for adding returns at the
beginning of each file adds an extra return at the end
with 5.6 and 5.7.  Tested in 5.6.0 on Linux, and with a
fairly recent snapshot also on Linux.

Tested and found working in 5.005_03 on both Linux and

perl -pi.bak -e 'BEGIN{undef($/)} s//\n/' foo*

The following code which should be equivalent does not
show the bug for me in a recent snapshot but it DOES on

perl -i.bak -e 'BEGIN{undef($/)} while (<>) {s//\n/; print;}' foo*

My guess is that this is a bug that was fixed in one place
but needs to be fixed in 2?


PS I have a report that neither bug showed up in
ActiveState's binary build 618.  The 5.6 tests were
consistent on 2 different machines.

Get your FREE download of MSN Explorer at Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About