Heh, liked the "Outlook is silly" flag.

Anyway, the difference has to do with newlines. Under Win32,
ActivePerl prints "\n" as "\r\n". Cygwin (depending on how
you have its filesystems configured) prints "\n" as "\n". Check 
the size of your output files. For a two line file, I would 
expect there is a 2 byte difference in size.

You could also do this under Cygwin:

  diff -b outfileAP outfileCyg

The -b option ignores differences in whitespace.

Or you could run a dos2unix program on your outfileAP
file to end up with exactly the same file as outfileCyg.

--
Mike Arms


-----Original Message-----
From: Steve Harper [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 13, 2002 4:04 PM
To: [EMAIL PROTECTED]
Subject: Search and replace one-liners in ActivePerl broken?


Can someone please tell me why the following doesn't work?  Observe:

In Windows 2000 CMD.exe, with ActiveState Perl 5.6.1 Build 631
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
D:\>copy con testtextfile.txt
This is this, that is that
Thats all folks!
^Z
        1 file(s) copied.

D:\>perl -pi.bak -e 's/this/that/g' testtextfile.txt

D:\>md5sum test*
ca08d1da587bff5a25bb33f22fa62df7 *testtextfile.txt
ca08d1da587bff5a25bb33f22fa62df7 *testtextfile.txt.bak

D:\>rm *.bak
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Now, lets try that in Cygwin w/ it's perl v5.6.1...

Administrator@PSIONIC /cygdrive/d
$ perl -pi.bak -e 's/this/that/g' testtextfile.txt

Administrator@PSIONIC /cygdrive/d
$ md5sum test*
74d5c5e10b51b882fa5438a4f99cc111 *testtextfile.txt
ca08d1da587bff5a25bb33f22fa62df7 *testtextfile.txt.bak

Administrator@PSIONIC /cygdrive/d
$
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I'm fairly perplexed by this difference in behaviour, I've read a fair
amount in the documentation to try to figure this out, but nothing I've
seen has really answered my question.  I'm sure its something stupid, like
shell differences, but it seems like the perl runtime is getting
everything it needs here and is still not making the changes to the file.

Thanks in advance for any help on this.

Steve Harper
Software Developer
Campus Student Computing
University Of Utah

_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to