in reply to How to download data from a table in Sybase and save the data in text file format using Perl?

Sorry, this is rather a comment than an answer. I'd like to come back on your $nl = "\r\n". HTTP specs want you to use CR+LF to end your lines. Your code works fine as long as your webserver runs on Un*x. If you try and run it on a Win32 machine (<troll>but why on earth would you do that? ;-) </troll>), then Perl will helpfully turn your \n into a CR+LF sequence, to adapt to the local custom. And you end up with CR+CR+LF, which is not exactly what you want.

So when dealing with a network protocol where ASCII values are important, \r\n should be written \015\012, be it only for the sake of portability.

--bwana147

  • Comment on Re: How to download data from a table in Sybase and save the data in text file format using Perl?
  • Select or Download Code

Replies are listed 'Best First'.
Re: Re: How to download data from a table in Sybase and save the data in text file format using Perl?
by tye (Sage) on Jun 11, 2001 at 20:57 UTC

    "\r\n" and "\015\012" in Perl will be handled the same everywhere except MacOS (and perhaps non-ASCII environments) so this practice is buying you little here. In particular, coding "\n" as "\012" does not stop Win32 from prepending a "\r" to it when output via a file handle that isn't in binmode.

            - tye (but my friends call me "Tye")