Alejandro Santillan Iturres <> wrote:
> I've tried this wonderful command:
> hexadump -c file.txt
> and I found that I have to include more and more chars to erase as
> follows:
> 
> $text=~s/\177//g;
> $text=~s/\377//g;
> $text=~s/\335//g;
> $text=~s/\360//g;
> $text=~s/\204//g;
> $text=~s/\222/\n/g;
> $text=~s/\214//g;
> $text=~s/\216//g;
> $text=~s/\224//g;
> $text=~s/\240//g;
> $text=~s/\237//g;
> $text=~s/\234//g;
> $text=~s/\325//g;
> $text=~s/\351//g;
> $text=~s/\352//g;
> $text=~s/\355//g;
> $text=~s/\361//g;
> $text=~s/\362//g;
> $text=~s/\366//g;
> 
> Is there a way to erase all the chars that are higher than, say, 300?
> Does this make sense?

Try:

$text =~ tr/\300-\377//d;

or with control characters (i.e. less than space) as well:

$text =~ tr/\000-\037\300-\377//d;

HTH

-- 
Brian Raven 

-----------------------------------------------------------------------------------------------------------
This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient or have received this e-mail in error, please advise 
the sender immediately by reply e-mail and delete this message and any 
attachments without retaining a copy. Any unauthorised copying, disclosure or 
distribution of the material in this e-mail is strictly forbidden.


_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to