It came up on the Git list[1] that perl -pi -e 's///' isn't portable to Windows for the same reason that sed -i isn't. Windows doesn't support clobbering. That leaves the question of what we should do. In 2002 Gerrit P. Haase thought that should be, on Cygwin[2]. +#if defined(__CYGWIN__) /* do backup extension automagically */ + if (*(s+1) == '\0') { + PL_inplace = savepv(".bak"); + return s+1; + } +#endif /* __CYGWIN__ */ That code is still sitting in perl.c today, silently turning "perl -pi -e 's///'" on Cygwin into "perl -pi.bak -e 's///'". Do we really want to do that? That means that this shellscript will silently break on Cygwin: echo foo > f && perl -pi -e 's/foo/bar/g' f && grep -q bar f Since perl will have silently created a f.bak with "bar" behind your back. Shouldn't we either die loudly saying that Windows doesn't support clobbering with "perl -pi", or at least do the same thing on Cygwin, Win32, MINGW etc? It seems nobody raised Unix shellscript compatibility when this was applied in 2002[3]. What do the sed implementations that have been ported to Windows do? Other than assume that they're still running on a Unix system, that is. 1. http://kerneltrap.org/mailarchive/git/2010/8/8/36314/thread#mid-36314 2. http://perl5.git.perl.org/perl.git/commitdiff/c030f24b?hp=4c7fc0a422d59e20b533b9ae25dd19c2ebfb68b6 3. http://www.nntp.perl.org/group/perl.perl5.porters/2002/05/msg60275.htmlThread Next