Please use code tags for your code snippets.
Is the above statement correct ????That depends on what you want $clock to contain. If you want it to simply be the string FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF05, then the following should be sufficient:
If you try to print out the value of $clock in your code, you might get:$clock = 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF05';
use warnings; use strict; my $clock = pack('H34','FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF05'); print "clock:$clock:\n"; for (split //, $clock) { print "$_:", ord $_, ":\n"; }
outputs (unprintable characters):
clock:\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uff +ff\uffff\uffff\uffff\uffff\uffff: \uffff:255: \uffff:255: \uffff:255: \uffff:255: \uffff:255: \uffff:255: \uffff:255: \uffff:255: \uffff:255: \uffff:255: \uffff:255: \uffff:255: \uffff:255: \uffff:255: \uffff:255: \uffff:255: :5:
Take a look at pack.
Update: By the way, a more compact way to assign a value to $clock uses the "repetition operator" (see perlop). These 2 lines are equivalent:
$clock = 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF05'; $clock = 'F' x 32 . '05';
In reply to Re: Device::Serial CP290
by toolic
in thread Device::Serial CP290
by GaTk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |