From: Neil C. <nc...@co...> - 2005-12-07 17:34:50
|
Matthew Williams wrote: > Neil Cherry wrote: >> @bytes = split //, $data; >> >> $byte = $bytes[0]; >> >> printf("GRRR iplcs Chk: 0x%02x (%s)[%d]\n", $byte, $hex, @bytes); >> > > Neil, try using $#bytes to get the length of the array. It is possible that > the printf isn't forcing perl to treat @bytes as a scalar. > > On a side note, @bytes = split //, $data will actually fill @bytes with > nibbles (half a byte), not bytes. You probably want something like this > instead: > > @bytes=unpack('(a2)*',$data); Oh, that makes more sense as to why I kept getting NULLs in my array. I'll give that a try. Thanks, I think you've resolved the last problem (I hope :-). -- Linux Home Automation Neil Cherry nc...@li... http://www.linuxha.com/ Main site http://linuxha.blogspot.com/ My HA Blog http://home.comcast.net/~ncherry/ Backup site |