> if -T ("looks like text file")
> If -B ("looks like binary file")
> 
> if -T $data ....
> if -B $data ....
> 
> HTH

Definitely! Thanks Paul. 
I never thought of using the file test operators on variables!
Cool.

Thanks!

> Paul
> -----Original Message-----
> From: Dan Muey [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, September 09, 2003 11:57 AM
> To: [EMAIL PROTECTED]
> Subject: Is $data binary or ascii?
> 
> 
> Say I have a variable $data that has file contents in it.
> Is there a way to tell if it is binary or ascii?
> 
> if($data =~ ???) { print "It is binary weeee"; }
> elsif($data =~ ???) { print "It is ascii woo hoo"; }
> else { print "I do not know what it is, doh!"; }
> 
> TIA
> 
> Dan
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to