$Bill wrote:
  >Suresh Govindachar wrote:
  >>  
  >> The following worked -- didn't need to turn off warnings.
  >
  > Not sure why, I get a warning on using ARGVOUT only once.
   
  Still no problems for me (5.8.8 on XP).

  >>   #!/usr/bin/perl
  >>   BEGIN {(*STDERR = *STDOUT) || die;}
  >
  > Not sure why you want the above.
  
  a) The stuff at the top is common to all perl scripts I write, and
     it is too much trouble to tweak them on a per-script basis.  
  
  b) The shebang line is when the script needs to be run on linux.

  c) The stderr to stdout mapping is to help with development under
     VIM.  In VIM, I have mapped <F5> to saving the file, marking
     the present location, jumping to the end of the file, executing
     the file, collecting the stdout output and appending the output
     to the end of the file and jumping to the first line appended.
     The stderr to stdout mapping helps capture error messages.

  >
  >>      use diagnostics;
  >>      use warnings;
  >>      use strict;
  >>      $| = 1;
  >
  > That could slow you down a bit by doing more writes.

  Good point.

  >>      $^I = '~';
  >>      while (<>)
  >>      {
  >>        binmode ARGVOUT if $. == 1; 
  >>        s/\r\n$/\n/;
  >
  > You don't need the above substitute.  Try it without it as I
  > posted it and let me know if it works.

  Works without the substitution.
  
  >>        print;
  >>      }
  >> 
  >>   And the one-liner becomes:
  >> 
  >>      perl -i~ -pe  "binmode ARGVOUT if $.==1; s/\r\n$/\n/;" <dossy
  >> files>
  >
  > Same here - no s/// needed:
  
  Works without the s///.

  > perl -i~ -pe  "binmode ARGVOUT if $.==1;" <dos-files>

  Made it into a doskey macro:
 
      d2u=perl -i~ -pe  "binmode ARGVOUT if $.==1;" $*

  --Suresh
  

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to