http://qs321.pair.com?node_id=121695


in reply to cleaning up control characters

I just changed your regular expression to match 0 to 2 control chars and replace them with nothing otherwise I did not touch the code.
[:cntrl:] is the key to matching any control chars.

#!/usr/bin/perl -w use strict; my ($infile, $outfile, $line); $infile = "c:/perldev/restore.txt"; $outfile = "c:/perldev/fixed_restore.txt"; open (INFILE, $infile) || die "Can't open $infile! $!"; open (OUTFILE, ">$outfile) || die "Can't open $outfile! $!"; while (<INFILE>) { $line = $_; $line =~ s/^[:cntrl:]{0,2}//; print OUTFILE $line; } close (INFILE); close (OUTFILE);
-monkfish (the fishy monk)

Edit fixed error with \C[