in reply to Strange character beginning text files
#!/usr/bin/perl use strict; use warnings; my $string = "\001hello\002world\003lookit\004these\005weird\006charac +ters"; my $string2 = $string; # replace ASCII chars from 0 to 8 with spaces $string =~ tr[\000-\010][ ]; # or delete weird chars: $string2 =~ tr[\000-\010][]d; print "string is $string\n"; print "string2 is $string2\n"; __END__
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Strange character beginning text files
by tachyon (Chancellor) on Jul 20, 2004 at 05:08 UTC | |
by beable (Friar) on Jul 20, 2004 at 07:55 UTC | |
by tachyon (Chancellor) on Jul 21, 2004 at 00:58 UTC |