Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: Detecting 'binary' in a variable

by dbwiz (Curate)
on Jul 05, 2005 at 18:19 UTC ( #472556=note: print w/replies, xml ) Need Help??


in reply to Re: Detecting 'binary' in a variable
in thread Detecting 'binary' in a variable

Not always

$ perl -le '{local$/; $_=<>;}print /^[\x00-\xA5]/ ? "binary" : "text" +' \ /mnt/win/WINDOWS/system32/command.com text

Replies are listed 'Best First'.
Re^3: Detecting 'binary' in a variable
by Transient (Hermit) on Jul 05, 2005 at 18:23 UTC
    That's correct, but that's not the same regexp:

    /^[\x00-\xA5]/
    ne
    /[^\x00-\xA5]/

      Sorry. My fault.

      But then, again, any text with accented vowels (à,è etc., in Italian, French, Spanish) will look like binary.

        \xA5 = 165 which should match just about everything except Greek (as per the OP's specs). Unicode not considered either.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://472556]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2020-10-20 15:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (210 votes). Check out past polls.

    Notices?