Re: Using Pack and Unpack

2017-12-07 Thread Martin McCormick
"John W. Krahn" writes: > > $ perl -le'my $x = sprintf q/%b/, 0xff; print $x' > > > use Data::Dumper; > $Data::Dumper::Useqq = 1; > > my $txstart = pack 'h*', 'fefe5a95'; > > print Dumper $txstart; Thank you and Shlomi Fish. I don't know when one stops being a beginner in perl beca

Re: Using Pack and Unpack

2017-12-07 Thread Shlomi Fish
On Wed, 06 Dec 2017 21:53:37 -0600 "Martin McCormick" wrote: > A perl program needs to send binary data to an external device > such that 0xff looks like > > I have a line in the program as follows: > > my $txstart = pack("h*","fefe5a95"); > > Are those 4 bytes usable as the bin

Re: Using Pack and Unpack

2017-12-06 Thread John W. Krahn
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 $ perl -le'my $x = sprintf q/%b/, 0xff; print $x' > I have a line in the program as follows: > > my $txstart = pack("

Using Pack and Unpack

2017-12-06 Thread Martin McCormick
A perl program needs to send binary data to an external device such that 0xff looks like 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