in reply to Can't find \x0D

By default, Perl converts \x0D\x0A to \x0A on read, and \x0A to \x0D\x0A on write on Windows. Use binmode($fh) to work with "binary" data.

Replies are listed 'Best First'.
Re^2: Can't find \x0D
by thornton102 (Novice) on Feb 07, 2011 at 16:42 UTC
    My apologies...this is on an AIX machine. I'm also using binmode. In fact, this is the entire program (just in case I leave any other important facts out! :) ):
    
    #!/usr/bin/perl
    
    use strict;
    
    my $inFile = "TST5.NDM.SB.IOWSFLAT.STMTS.MRDF.TEST";
    my $outFile = "$inFile.out";
    my $buff;
    
    open(INFP, $inFile);
    open(OUTFP, ">$outFile");
    binmode(INFP);
    binmode(OUTFP); 
    
    my $cnt = 1;
    my $matchCnt = 0;
    
    while (read(INFP, $buff, 128)) {
    
      print OUTFP $buff;
      
      my $target = "\x0D";
      if ($buff =~ /$target/) {
        print $buff;
        print "\n found \$target on 'line' $cnt, ";
        print "'" . ord($&) . "', '\x$&'\n";
        ++$matchCnt;
      }
      ++$cnt;
    }
    
    print "found target $matchCnt times\n";
    close (INFP);
    close (OUTFP);
    

      Either you looked at the file using UltraEdit or you're running on AIX. Both aren't possible since UltraEdit doesn't run on AIX.

      Did you perhaps FTP the file between the two systems using ASC mode?