On Wed, 2017-12-06 at 21:53 -0600, Martin McCormick wrote:
> A perl program needs to send binary data to an external device
> such that 0xff looks like 11111111
$ perl -le'my $x = sprintf q/%b/, 0xff; print $x'
11111111
> I have a line in the program as follows:
>
> my $txstart = pack("h*","fefe5a95");
>
> Are those 4 bytes usable as the binary data
>
> fe fe 5a 95?
>
> Is there a good way when running perl -d to view the
> contents of the string to make sure it is what it should be?
use Data::Dumper;
$Data::Dumper::Useqq = 1;
my $txstart = pack 'h*', 'fefe5a95';
print Dumper $txstart;
John
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/