Steve wrote as a deprecated top post:
> $Bill wrote:
>> Suresh Govindachar wrote:
>>>
>>> [almost working code]
>>
>> Try:
>> > $^I = '~'; no warnings 'once';
>> while (<>) { binmode ARGVOUT if $. == 1; print; }
>
>The following worked -- didn't need to turn off warnings.
>
> #!/usr/bin/perl
> BEGIN {(*STDERR = *STDOUT) || die;}
> use diagnostics;
> use warnings;
> use strict;
> $| = 1;
>
> $^I = '~';
> while (<>)
> {
> binmode ARGVOUT if $. == 1; s/\r\n$/\n/;
> print;
> }
>
>And the one-liner becomes:
>
> perl -i~ -pe "binmode ARGVOUT if $.==1; s/\r\n$/\n/;" <dossy files>
>
>
> What about Ctrl-Z? Ctrl-Z at the end of a DOS file is another
> difference between DOS and Unix files.
Not sure. The VIM text editor, by default, includes an
end-of-file marker on any OS.
Wouldn't a text file in unix format on Windows still have a
Windows end-of-file marker?
How do you know whether or not a file has an end-of-file marker
and if it does, what the marker is (^Z? ^D? something else?).
Did you try either version of the perl code on a dossy file, and
if so, did the end-of-file marker vanish?
Please provide examples of a dossy file and two unix'ified
versions it, one with the end-of-file maker and the other without.
Thanks,
--Suresh
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs