Sorry for being contrarian here, but this is wrong.  Unconditionally blowing
away control characters is not the right way to do anything.  Using Perl's
own encoding disciplines is the right way to do this.  While this tr// may
work in this case and on other simple files, u just don't know what
legitimate unicode is in there that u want to keep.  Especially on Windows.


At 09:22 AM 3/27/2009 +0900, [email protected] wrote:
>Here's the preferred way of opening files along with the magic tr operator:
>
>use strict;
>use warnings;
>use Fatal qw( open );
>
>my $file = 'msinfo.txt';
>
>open my $FILE, '<', $file;
>while ( <$FILE> )
>{
>    tr/\x20-\x7f//cd;
>
>    print "$_\n";
>}
>close $FILE;
>
>
>__END__




--
REMEMBER THE WORLD TRADE CENTER         ---=< WTC 911 >=--
"...ne cede malis"

00000100

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to