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.
[:cntrl:] is the key to matching any control chars.
-monkfish (the fishy monk)#!/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);
Edit fixed error with \C[
In Section
Seekers of Perl Wisdom