Chris Knipe wrote:
Hi,
Hello,
I have bit of problem with transparent squid service. When people tries to send binary data through squid, the log files naturally doesn't like it very much. A sample of such an log file entry: 1308293915.456 0 client.host.name NONE/400 3660 [<FF><92>i<8F>>^]^D<D5>^N<9F>?<EF><EA>[<BB>y<81>'4/^<F1><92>k<FA>I<FB><A3>${ b<8B><D2><AE>o^S %87)d%B8%5B%F6W%A2$%5C - NONE/- text/html I am trying to write perl regex to skip lines containing these characters, but I'm not having too much success: while (<>) { chomp($_); if ($_ =~ s/[\t\n\r\f\a\e\cK]//g) { next; } else { print $_ . "\n"; } } Does anyone perhaps have some insight for me?
while ( <> ) { chomp; next if /[^[:ascii:]]/; print "$_\n"; } John -- Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction. -- Albert Einstein -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/