PiEquals3 has asked for the wisdom of the Perl Monks concerning the following question:
$ifn=$ARGV[0];$ofn=$ARGV[1]; open IFN, "$ifn" or die "Can't open $ifn:$!\n"; open OFN, ">$ofn" or die "Can't open $ofn:$!\n"; while(<IFN>){ $_ =~ s/[^\x20-\x7e\x0d\x0a\x0c\x09]/ /g; print OFN; };
A problem arose when 0x1A occured in the file: The output file ended on the preceding character!
The name of this character is "substitute", but the control character is ^Z (the EOF marker, I believe. Forgive me, I have to use Windows NT.) My suspicion is that, upon reading this character, <> assumes EOF and leaves the loop.
Is there a way to read past this character safely? What could I do?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reading past an artificial EOF?
by chipmunk (Parson) on Jan 13, 2001 at 00:09 UTC | |
by PiEquals3 (Acolyte) on Jan 13, 2001 at 00:20 UTC | |
|
Re: Reading past an artificial EOF?
by Chady (Priest) on Jan 13, 2001 at 00:15 UTC | |
|
Re: Reading past an artificial EOF?
by PiEquals3 (Acolyte) on Jan 13, 2001 at 00:30 UTC | |
by Anonymous Monk on Jan 13, 2001 at 02:44 UTC |