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);
| [reply] |
| [reply] |