On Dec 3, Kipp, James said:
>Is the perl getc() function the best way to look at one char at a time?
The C way is always never the Perl way.
> while ( !feof(fin) ) {
> ch=getc(fin);
>
> if ( (ch<=0176) && (ch>=040) || (ch=='\n') ) {
> putc( ch, stdout );
> } else {
> putc( ' ', stdout );
> }
> }
perl -pi.bak -e 'tr/\040-\176\n/ /c' file
That'll change all characters that are NON between 0040 and 0176 and \n
into spaces.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
<stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
[ I'm looking for programming work. If you like my work, let me know. ]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]