Powershell overruling Perl binmode?

Posted by hippietrail on Super User See other posts from Super User or by hippietrail
Published on 2011-01-12T02:16:59Z Indexed on 2011/01/12 2:55 UTC
Read the original article Hit count: 425

Filed under:
|
|
|
|

I have a Perl script which creates a binary file while scanning a very large text file. It outputs to STDOUT which I redirect in the commandline to a file.

To optimize it I'm making changes then seeing how low it takes to run. On Linux for this I use the "time" command. On Windows the best way to time a program seemed to be to PowerShell's "measure-command". This seemed to work fine but I noticed the generated files were larger. On examination I found that the files generated from within PowerShell begin with a BOM and contain CRLF pairs!

My Perl script has a "binmode STDOUT" directive and does work correctly in a normal dosbox.

Is this a bug or misfeature in PowerShell or measure-command? Has it affected others creating binary files by means other than Perl?

Googling hasn't turned anything up so far. I'm using Perl 5.12, PowerShell v1.0 and Windows XP.

© Super User or respective owner

Related posts about Windows

Related posts about powershell