Dan Muey wrote:
>
> 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!"; }
if ( $data =~ /[^[:ascii:]]/ ) {
print "\$data contains non-ASCII characters\n";
}
else {
print "\$data contains only ASCII characters\n";
}
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]